Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Navigate to the directory of the current 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.

  3. Edit the file adding or replacing the template override for the result item:

    Code Block
    languagehtml
    <script id="vue-hawksearch-result-item" type="x-template">
        <div class="media-body sf-media-body">
            <h3>
                <template v-if="link">
                    <a :href=link>{{ title }}</a>
                </template>
                <template v-else>
                    {{ title }}
                </template>
            </h3>
            <p>
                <span>{{ result.BestFragments['itemname'] }}</span>
                <span>{{ content }}</span>
            </p>
            <a :href="link">{{ link }}</a>
        </div>
    </script>

    The key change here is the field reference to the BestFragments object (line 12). In this case, the itename is displayed. Other available fields can be displayed in a similar manner.

  4. Include the file in the project and make it an Embedded resource in the Visual Studio solution.

  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.

...