/
Example: Extending result item component with date fields

Example: Extending result item component with date fields

Steps to extend

  1. Navigate to the directory of the currently active widget template (e.g. Mvc\Views\Hawksearch\Hawksearch.Default.cshtml or the relevant resource package).

  2. Copy the file of the base template and name it accordingly (Hawksearch.CustomDateFormat.cshtml for example).

  3. Edit the file adding or replacing the template override for the result item. Make sure to parse the date in the format from the search request-response. Additional information on date parsing formats can be found here.

    <script id="vue-hawksearch-result-item" type="x-template"> <div> <p>{{ moment(getField('date'), 'YYYY-MM-DD').format('DD, M YYYY') }}</p> </div> </script>
  4. Include the file in the project.

  5. Save, build and reload the site.

  6. Open the widget designer for Hawksearch results widget on the designated page and select the newly created template from the select list. Save and publish the page. Configuring Hawksearch results widget

Related content

Customize search results in Vue.js
Customize search results in Vue.js
More like this
Extending templates
Extending templates
More like this
Example: Overriding the result item component to include images and links
Example: Overriding the result item component to include images and links
More like this
Example: Overriding the result item component with two column layout using bootstrap classes
Example: Overriding the result item component with two column layout using bootstrap classes
More like this
Example: Extending search results to include properties of JSON field
Example: Extending search results to include properties of JSON field
More like this
Example: Extending the results set
Example: Extending the results set
More like this