What does your JS template looks like where that variable is being output?
Even using the default instantsearch.php template it does it.
So post_title looks like this:
{{{ data._highlightResult.post_title.value }}}
and {{ data.post_title }} where it is used.
Howdy @joncampbell
When I add a test post into my local dev install, using an ampersand character in the title, I do not experience that behavior. It is stored in both my WP database and in my Algolia index as the &
character. When I search for that post on the front end with instantsearch and autocomplete the character displays as an ampersand, not the HTML entity.
Do you know if it is stored as an HTML entity in your WP database?
Cool cool cool.
My titles and terms have the html entities stored in the WordPress database.
I’ll just go have a good cry and then ask my client why we are doing that.
@richaber It looks like the post titles is something we can fix in our content.
But the categories it seems like WordPress saves those to the database with the full html entity, instead of just the ampersand.
Maybe that is something that could be fixed in the plugin for everyone.
Howdy @joncampbell,
I am unable to reproduce the issue locally.
When I check my database for the term “Marketing & Finance”, indeed I see the ampersand as an HTML entity in the database:
mysql> SELECT * FROM local.wp_terms WHERE name LIKE "%Marketing%";
+---------+-------------------------+-------------------+------------+
| term_id | name | slug | term_group |
+---------+-------------------------+-------------------+------------+
| 202 | Marketing & Finance | marketing-finance | 0 |
+---------+-------------------------+-------------------+------------+
However, when I check my Algolia index record, the ampersand does not appear as an HTML entity there:
{
"term_id": 202,
"taxonomy": "category",
"name": "Marketing & Finance",
"description": "",
"slug": "marketing-finance",
"posts_count": 1,
"permalink": "http://algolia.test/category/marketing-finance/",
"objectID": "202"
}
If I search for “Marketing” in my test site, the autocomplete drop down does not display the ampersand as an html entity, but as the decoded &
character.
Can you determine if the ampersand is encoded as an HTML entity in your Algolia index? Also, where the value is visibly output, can you check that the code is using the triple-stash style for unescaped output {{{ value }}}
.