Skip to main content
Version: 11.14.0

getMetadata

Retrieves metadata from an article record and returns it as a normalized array of display objects. Useful for rendering metadata fields (authors, keywords, dates, etc.) in a consistent format.

Parameters

ParameterTypeRequiredDescription
articleArticleThe article object to extract metadata from
metadataKeyOf<Article>The field key to retrieve

Returns { display: string }[] — array of display objects, one per metadata value.

Example

get-metadata.ts
import { getMetadata } from '@sinequa/atomic';

const article = {
id: '123',
title: 'Sample Article',
authors: ['John Doe', 'Jane Smith'],
keywords: ['technology', 'research']
};

const authors = getMetadata(article, 'authors');
// [{ display: 'John Doe' }, { display: 'Jane Smith' }]

const keywords = getMetadata(article, 'keywords');
// [{ display: 'technology' }, { display: 'research' }]