🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
API Reference / API Parameters / highlightPostTag
Type: string
Engine default: "</em>"
Parameter syntax
'highlightPostTag' => 'closing_tag'

Can be used in these methods:

About this parameter

The HTML string to insert after the highlighted parts in all highlight and snippet results.

Usage notes

  • highlightPostTag needs to be used along with highlightPreTag
  • If you specify an empty string, the engine will use the default </em> tag instead
  • To turn off highlighting, remove the searchable attribute with the attributesToHighlight parameter

Examples

Set default highlight post tag

1
2
3
$index->setSettings([
  'highlightPostTag' => '</em>'
]);

Override default highlight post tag for the current search

1
2
3
$results = $index->search('query', [
  'highlightPostTag' => '</strong>'
]);
Did you find this page helpful?