Skip to content
This repository has been archived by the owner on May 9, 2019. It is now read-only.

<em> tags display in autocomplete results #817

Open
kv-bluemillion opened this issue Feb 6, 2019 · 7 comments
Open

<em> tags display in autocomplete results #817

kv-bluemillion opened this issue Feb 6, 2019 · 7 comments
Labels

Comments

@kv-bluemillion
Copy link

kv-bluemillion commented Feb 6, 2019

What did you expect to happen?

When searching in autocomplete, I expected tags to display text as italic (due to css styling), but looks like all html tags render as plain text.

What happened instead?

html tags (ie-) display as text and not rendered html.

How can we reproduce this behavior?

search for "r. equi" in the right column search box.

Can you provide a link to a page which shows this issue?
http://staging-thehorse.kinsta.com/

Technical info

  • WordPress version:5.0.3
  • Algolia Search plugin version:2.11.3
screen shot 2019-02-06 at 12 03 14 pm
@rayrutjes
Copy link
Member

👋 This is a little surprising because by default the em tags are not used in the WP plugin.
Did you customize something? Because we have in place a special logic in order to avoid XSS.

@kv-bluemillion
Copy link
Author

kv-bluemillion commented Feb 7, 2019

There's been no customization that I'm aware of. However, I've been wondering if it has something to do with the highlighting prefix? Looked at it this morning and it's set to <bold>.

@rayrutjes
Copy link
Member

By default the plugin should use the prefixes defined here: https://github.com/algolia/algoliasearch-wordpress/blob/master/templates/autocomplete.php#L99

Those are then replace by <em> tags however they should not be escaped again.

Could you compare the code you have with the one of the file linked above?

Maybe you are using an older version that had a different behavior?

Keep me posted,

@kv-bluemillion
Copy link
Author

Ran a text compare, and no differences.

@kv-bluemillion
Copy link
Author

Update: I did a search for anything custom, and we do have a small bit of code in functions.php that is designed not to index pages where the robot index option in the Yoast SEO plugin is set to noindex. Code below:
`function filter_post( $should_index, WP_Post $post )
{
if ( false === $should_index ) {
return false;
}

return get_post_meta($post->ID, '_yoast_wpseo_meta-robots-noindex', true) == 1 ? false : true;
}

// Hook into Algolia to manipulate the post that should be indexed.
add_filter( 'algolia_should_index_searchable_post', 'filter_post', 10, 2 );
add_filter( 'algolia_should_index_post', 'filter_post', 10, 2 );
/**
 * Dequeue default CSS files.
 *
 * Hooked to the wp_print_styles action, with a late priority (100),
 * so that it is after the stylesheets were enqueued.
 */
function my_theme_dequeue_styles() {
  // Remove the algolia-autocomplete.css.
  wp_dequeue_style( 'algolia-autocomplete' );
}
add_action( 'wp_print_styles', 'my_theme_dequeue_styles', 100 );`

Could this be having an effect?

@rayrutjes
Copy link
Member

I don't think the above could affect the output.

Could you confirm that you do not have a custom autocomplete.php implementation in your theme?

@kv-bluemillion
Copy link
Author

Correct. We do NOT have a custom autocomplete.php implementation. Code comparison was identical.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants