Find 25.1
Find Administration Guide

# Example Templates

This page contains some simple examples of templates. There are more examples of default templates available at:

https://github.com/opentext-idol/find/tree/master/webapp/core/src/main/public/static/js/find/templates/app/page/search/default-custom-templates/

## Simple Template

The following template is a simple search result template that displays a thumbnail image for documents that contain a `thumbnail` field. It also displays the document summary, the `authors` field, and a link to get similar documents.

    <div>
        <h1><i class="{{icon}}"></i>{{title}}</h1>
        {{#hasField 'thumbnail'}}
           <img src="{{thumbnail}}"/>
        {{/hasField}}
        <p>{{{summary}}}</p>
        <p>Author: {{getFieldValue "authors"}}</p>
        <a href="{{similarDocumentsUrl}}">See similar documents</a>
    </div>

## Multiple Format Styles

The following example shows some different ways of formatting the `authors` field in your results.

    <p>Authors: {{getFieldValues "authors"}}</p>
    <p>Only the first author: {{getFieldValue "authors"}}</p>
    <p>
        Formatting all authors as badges:

        {{#getFieldValues "authors" ellipsis='<font color="gray">...</font>'}}
            <span class="badge"> {{ this }} </span>
        {{else}}
            (no authors)
        {{/getFieldValues}}
    </p>
    <p>
        Only showing the first author as a single badge:

        {{#getFieldValue "authors"}}
            <span class="badge"> {{ this }} </span>
        {{else}}
            (no author)
        {{/getFieldValue}}
    </p>
    <p>
        Only showing the first two authors, the rest as ellipsis:

        {{#getFieldValues "authors" max=2 ellipsis='<font color="gray">...</font>'}}
            <span class="badge"> {{ this }} </span>
        {{else}}
            (no authors)
        {{/getFieldValues}}
    </p>

For example, if you have the following Knowledge Discovery document:

    #DREREFERENCE format-test
    #DRETITLE Formatting test
    #DREFIELD DOCUMENT_METADATA_AUTHOR_STRING="Alice"
    #DREFIELD DOCUMENT_METADATA_AUTHOR_STRING="Bob"
    #DREFIELD DOCUMENT_METADATA_AUTHOR_STRING="Charlie"
    #DRECONTENT
    Written by Alice, Bob and Charlie
    #DREENDDOC
    #DREENDDATANOOP

and a complementary configuration in the `fieldsinfo` section of the Find `config.json` file:

    "authors": {
       "names": [
          "AU_DOCUMENT_METADATA_AUTHOR_STRING",
          "DOCUMENT_METADATA_AUTHOR_STRING"
       ]
    }

For this example template and document, Find displays the following:

For a document without any authors, Find displays the following:

Copyright 2015-2024 Open Text
Version 25.1 | Last updated January 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery Find 25.1

Topic Title: Example Templates