Search Results page
Search Results page
The Search Results page template is rendered when a user navigates to https://{yoursubdomain}.zendesk.com/hc/{locale}/search
.
Available properties
You can use the following properties in the search results template.
Name | Type | Description |
---|---|---|
query | string | The searched query |
results_count | integer | The number of results of the search |
results | array | An array of search result objects containing all the article and post results from the knowledge base and community |
promoted_articles | array | An array of promoted article objects |
ticket_forms | array | An array of ticket form objects |
help_center | object | A help_center object that holds information and settings about the current help center |
settings | object | A settings object with custom settings for the current theme |
help_center_filters | array | An array of filter objects. Use these filters to iterate through help centers when searching multiple help centers |
source_filters | array | An array of filter objects. Use these filters to iterate through help centers and external sources when searching multiple help centers and/or external sources |
type_filters | array | An array of filter objects. Use these filters to iterate through content types (articles, posts or external types) when searching across multiple content types |
filters | array | An array of filter objects |
subfilters | array | An array of filter objects. Use these filters to drill down into the search results categories (for knowledge base results) or topics (for community posts) |
content_tag_filters | array | An array of filter objects. Use these filters to iterate through content tags when searching by them. Searching by multiple content tags isn't supported |
signed_in | boolean | Whether the user is logged in or not |
featured_posts | array | An array of featured post objects |
brand | object | A brand object representing the current brand |
user | object | A user object representing the current user |
Available helpers
You can use the following helpers in this page template. You can also use any built-in helpers, global helpers, or global advanced helpers.
Name | Description |
---|---|
breadcrumbs | Breadcrumbs for the search page. See breadcrumbs helper |
pagination | Pagination links. See pagination helper |
Example
<nav class="sub-nav sub-nav-far clearfix">
{{breadcrumbs}}
{{search}}
</nav>
<div class="search-results clearfix">
<h1>{{results_count}} results found for "{{query}}"</h1>
{{#each help_center_filters}}
<li>
<a href="{{url}}">{{name}} ({{count}})</a>
</li>
{{/each}}
{{#each filters}}
<li>
<a href="{{url}}">{{name}} ({{count}})</a>
</li>
{{/each}}
{{#each subfilters}}
<li>
<a href="{{url}}">{{name}} ({{count}})</a>
</li>
{{/each}}
{{#each results}}
<div>
<a href="{{url}}">{{title}}</a>
<p class="search-result-description">{{text}}</p>
</div>
{{/each}}
</div>
{{pagination}}