Skip to content

Mapping Flourish content tree node to bodyXML tags and vice versa #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
epavlova opened this issue Apr 10, 2025 · 2 comments
Open

Mapping Flourish content tree node to bodyXML tags and vice versa #74

epavlova opened this issue Apr 10, 2025 · 2 comments

Comments

@epavlova
Copy link
Contributor

Background

The Flourish node in content tree is defined as:

interface Flourish extends Node {
	type: "flourish"
	id: string
	layoutWidth: string
	flourishType: string
	description?: string
	timestamp?: string
	fallbackImage?: Image
}

In bodyXML, a flourish graphic is represented as link of type <ft-content>. Example What Brussels’ new industry chief plans for Europe’s car industry, Dec 2024:

<ft-content 
    type="http://www.ft.com/ontology/content/Content" 
    url="http://api.ft.com/content/20543674" 
    alt="" 
    data-asset-type="flourish" 
    data-embedded="true" 
    data-flourish-type="visualisation" 
    data-layout-width="" 
    data-time-stamp="" 
    id="20543674">
</ft-content>

fallbackImage attribute

The fallbackImage attribute doesn't have equivalent representation in bodyXML.

alt attribute

The bodyXML flourish tag has an alt attribute which is not present in the content tree node. It seems widely used, around 4618 articles with flourish graphics have non empty alt attribute of their flourish tags.

Example Trump tracker: US tariffs, Apr 2025:

<ft-content 
    type="http://www.ft.com/ontology/content/Content"
    url="http://api.ft.com/content/21484860" 
    alt="Extra navigation controls which are active with web connect" 
    data-asset-type="flourish" 
    data-embedded="true" 
    data-flourish-type="visualisation" 
    data-layout-width="" 
    data-time-stamp="2025-03-07T17:35:27.334Z" 
    id="21484860">
</ft-content>

Possible approaches

It seems reasonable to extend the content tree definition of Flourish node to include the alt attribute. It is open question how fallbackImage should be transformed in bodyXML.

@adgad
Copy link
Collaborator

adgad commented Apr 30, 2025

I think fallbackImage needs to be external - CP fetches this from Flourish's API so it isn't part of the content platform.

The lack of alt text is funny. I'm not entirely sure what the intention was - whether it's supposed to be the alt attribute for the fallback image, or text to show to users when the flourish frame doesn't load (alongside the fallback image). Maybe need someone from Storytelling to confirm

@adgad
Copy link
Collaborator

adgad commented May 7, 2025

#80 This PR addressed the fallbackImage thing.

In our transformer in from-bodyxml we are mapping the alt attribute to description in content-tree.
In cp-content-pipeline it is mapping a non-existent description attribute to description.
In Spark, it's doing something weird.

So I think from-bodyxml is correct, cp-content-pipeline and spark are incorrect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants