@financial-times/n-display-metadata

2.0.1 • Public • Published

n-display-metadata

CircleCI NPM version

This module encapsulates the editorially selected logic for deciding which metadata items to display in teasers and article toppers.

Installation

This is a Node.js module available through the npm registry. Before installing, download and install Node.js. Node.js 18 or higher is required.

Installation is done using the npm install command:

$ npm install -S @financial-times/n-display-metadata

Usage

This module provides a method for each use case. Currently there is just one method for choosing which metadata to display on the teaser.

const metadata = require('@financial-times/n-display-metadata');

const teaserMetadata = metadata.teaser(content);

References to the variable content refer to a content item either from the internal enriched content API or the FT.com Elasticsearch cluster. The content should have an annotations property (which is an array of concepts and their relationship to the content) and containedIn property (which is an array of packages which contain the content).

API

.teaser(content)

Returns an object with 3 properties:- prefixText, link and altLink. The altLink can be used when the current context of the teaser is the same as the link, e.g. to avoid displaying links to "FastFT" on the FastFT stream page. It is up to the implementor to add this logic.

.topper(content)

Coming soon.

Content

All

Logic

Both teasers and toppers are capable of displaying two pieces of metadata:- a prefix and a link. Though similar decisions may be made for each, they are not strictly connected.

Teasers

The logic for choosing which metadata to display on teasers was last decided by Mus and Guy on 28/08/2018 and implemented by Matt Hinchliffe on 29/08/2018.

The current decision trees can be seen in the docs folder

Readme

Keywords

none

Package Sidebar

Install

npm i @financial-times/n-display-metadata

Weekly Downloads

2,265

Version

2.0.1

License

ISC

Unpacked Size

11.7 kB

Total Files

22

Last publish

Collaborators

  • robertboulton
  • seraph2000
  • hamza.samih
  • notlee
  • emmalewis
  • aendra
  • the-ft
  • rowanmanning
  • chee
  • alexwilson