@financial-times/n-display-metadata

    1.0.0 • 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 6 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

    Keywords

    none

    Install

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

    DownloadsWeekly Downloads

    159

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    373 kB

    Total Files

    23

    Last publish

    Collaborators

    • aendra
    • briggsc
    • the-ft
    • quarterto
    • rowanmanning
    • mattandrews
    • jakedchampion
    • sdbernard
    • bobhaslett
    • joannaskao
    • robinmarr-ft
    • ft-internal-products
    • chee
    • notlee
    • tatiana.stantonian
    • conor-mullen
    • alexwilson