atomic-result-template

The atomic-result-template component determines the format of the query results, depending on the conditions that are defined for each template. A template element must be the child of an atomic-result-template, and an atomic-result-list must be the parent of each atomic-result-template.

Properties

Property Attribute Description Type Default

conditions

A function that must return true on results for the result template to apply.

For example, a template with the following condition only applies to results whose title contains singapore: [(result) => /singapore/i.test(result.title)]

ResultTemplateCondition[]

[]

Methods

getTemplate

Gets the appropriate result template based on conditions applied.

Signature: getTemplate() => Promise<ResultTemplate<TemplateContent> | null>

Returns: Promise<ResultTemplate<TemplateContent> | null>

Recommended Articles