Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Overview

The Custom Content component renders a custom list of search results (typically products) defined as Spotlights in Hawksearch.

This is commonly used to display products when a query returns no results.

Selector

The selector for this component is <hawksearch-featured-items-content>.

Data Model

The following data model is exposed to the Handlebars template:

interface ContentType {
    id: number;
    campaignId: number;
    type: string;
    title: string;
    zone: string;
}

interface FeaturedItemsContent extends ContentType {
    type: 'featured-items';
    items: Array<SearchResultsItem>;
}

For more information, see Search Models.

Default Template

<div class='row featured-items-content'>
    {{#each items}}
        {{#if (or (eq @root.zone 'Top') (eq @root.zone 'Top2') (eq @root.zone 'Bottom') (eq @root.zone 'Bottom2'))}}
            {{#if (eq type 'content')}}
                <div class='column column--12'>
                    <hawksearch-featured-items-content-item></hawksearch-featured-items-content-item>
                </div>
            {{else}}
                <div class='column column--12 column-sm--6 column-lg--4'>
                    <hawksearch-featured-items-content-item></hawksearch-featured-items-content-item>
                </div>
            {{/if}}
        {{else}}
            <hawksearch-featured-items-content-item></hawksearch-featured-items-content-item>
        {{/if}}
    {{/each}}
</div>
  • No labels