@coveo/headless
    Preparing search index...

    Interface ResultTemplatesManager<Content, LinkContent>

    interface ResultTemplatesManager<Content = unknown, LinkContent = unknown> {
        registerTemplates(...newTemplates: ResultTemplate<Content>[]): void;
        selectLinkTemplate(result: Result): null | LinkContent;
        selectTemplate(result: Result): null | Content;
    }

    Type Parameters

    • Content = unknown
    • LinkContent = unknown
    Index

    Methods

    • Selects the highest priority template for which the given result satisfies all conditions. In the case where satisfied templates have equal priority, the template that was registered first is returned.

      Parameters

      • result: Result

        (Result) The result for which to select a template.

      Returns null | Content

      (Content) The selected template's content, or null if no template's conditions are satisfied.