Skip to content

Add RawImage support #102

@adgad

Description

@adgad

What is RawImage

There's also something called RawImage in cp-content-pipeline. I believe this was created to handle Wordpress images:
https://github.com/Financial-Times/cp-content-pipeline/blob/bfc0b2219f8b6b8c3ae12bc29cbcd736bda6c7ba/packages/schema/src/resolvers/content-tree/Workarounds.ts#L26

Is it possible to produce these in Spark

No* (although pending confirmation with LayoutImage)

Why do we need to support it?

Images are considered "core" content that we should support for as long as humanly possible, and therefore we need to ensure images published in Wordpress and pre-spark still work after moving to content-tree rendering.

Publishing these images as proper ImageSets would require a lot of effort, and so it is simpler to maintain support for a RawImage node, and comment on its' deprecation.

Proposed Schema

/*
Raw Image nodes only exist because of old Wordpress articles,
and so will not be added to content-tree.

Since we still need to render them, we will create a
custom type, which will be used to map the img tags to a node.

Once all old articles in the Content API are migrated to use
content-tree, we should migrate those old img tags and publish them
through the content API, at which point we can remove this workaround.

example article: https://www.ft.com/content/6c7a0c9a-1913-30a2-a317-24d2623e1865
*/

export interface RawImage extendsNode {
type: 'raw-image'
caption: string
credit: string
alt: string
url: string
format: 'standard'
height?: number
width?: number
}

TODO: keep the name RawImage? or ExternalImage? Changing the name would require updating cp-content-pipeline

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions