Search suggestions are designed for use with the search bar on the Home page, but can be used anywhere in the help center.
Search suggestions can be added to the Home page (home_page.hbs
) using the Popular keywords theme setting in the Home page elements setting group.
- Select a style from the Popular keywords style dropdown list.
- Enter one or more keywords in a comma-separated list.
The search suggestions will then appear below the search bar in the hero element in the style selected.
To use a custom pattern, copy the <template>
from your selected pattern into the bottom of the Footer (footer.hbs
) template.
Search suggestions can be added to any page by copying-and-pasting the following hook into a page template:
{{~#isnt settings.popular_keywords_style 'none'}}
{{~#if settings.popular_keywords}}
<div id="popular-keywords">
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', () => {
Util.renderTemplate(document.getElementById('popular-keywords'), 'popular-keywords', {
keywords: '{{#if settings.use_translations}}{{dc settings.popular_keywords}}{{else}}{{settings.popular_keywords}}{{/if}}'
});
})
</script>
</div>
{{/if~}}
{{/isnt~}}}
The search suggestions will appear in the position of the hook element on the page.
To use a custom pattern, copy the <template>
from your selected pattern into the bottom of the Footer (footer.hbs
) template.
If you select the Custom template style option, copy-and-paste your selected pattern template into the bottom of the Home page (home_page.hbs
) or Footer (footer.hbs
) templates.