In order to index special characters with meta tags, you’ll want to ensure the
content attribute value of your tags are escaped.
More specifically, to set a custom title with a quotation mark in it, you’ll need to make sure the quotation marks are escaped as HTML entities.
For example, a title like:
This is a "title"
Would be properly represented by a meta tag value such as:
<meta class="swiftype" name="title" data-type="string" content="This is a "title"" >
The exact method will depend on the server side language you’re using. If you’re using PHP, you could use code like this:
<meta class="swiftype" name="title" data-type="string" content="<?php echo htmlentities($title); ?>" >
For Ruby on Rails, simply use
<%= %> in your view, since Rails will escape HTML entities in the view by default:
<meta class="swiftype" name="title" data-type="string" content="<%= @title %>" >
Another approach to this example would be to use our in-line data attribute tags to annotate the part of the page you want to be the title:
<h1 data-swiftype-name="title" data-swiftype-type="string">This is a "title"</h1>