Skip to content

[WIP] Support lead image opt out [WHIT-2801]#11220

Draft
ChrisBAshton wants to merge 8 commits intomainfrom
support-lead-image-opt-out
Draft

[WIP] Support lead image opt out [WHIT-2801]#11220
ChrisBAshton wants to merge 8 commits intomainfrom
support-lead-image-opt-out

Conversation

@ChrisBAshton
Copy link
Contributor

@ChrisBAshton ChrisBAshton commented Mar 10, 2026

What

This PR adds user journeys to opt out of ("Remove") the default lead image, and opt back in ("Use default image"), alongside the usual custom lead image journey.

I've followed the designs in Confluence

Why

This follows a commitment we've already made to publishers for config-driven news articles.

Jira: https://gov-uk.atlassian.net/browse/WHIT-2801


⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

This application is owned by the Whitehall Experience team. Please let us know in #govuk-whitehall-experience-tech when you raise any PRs.

Follow these steps if you are doing a Rails upgrade.

@ChrisBAshton ChrisBAshton changed the base branch from change-payload-for-lead-images to main March 10, 2026 08:45
… 'type' lead, with 'sources'

To ensure a consistent image payload across types, we are bringing the lead image payload in line with that of the other non-embeddable images, such as topical events' headers and logos, and history pages' sidebar.

The change is from sending a singular `details.image` to sending `details.images` with a `type` to identify the `usage`, and a hash of `sources` corresponding to the various image variants, rather than the `url`, `high_resolution_url`, `medium_resolution_url` we were sending prior. Since the code is scoped to config-driven document types, this change only affects news articles. History pages have been dealt with separately, and republished.

This change is accompanied by changes in publishing API, Frontend, and the metadata component (which looks for a url). All these changes will require a 2-step release: an expand to allow both payloads, then a contract after republishing. All news articles will require republishing for the change to take effect.

Note on the payload specifics:
- We have agreed with Frontend owners that, in order to keep the API consistent, and the FE code relatively simple, we will send the `sources` hash with all the variant keys, even for cases where the image is not truly "versioned". In the case of lead images, that's the placeholder image, which we now send replicated for all the versions ("default" kind's versions: s960, s712, s630, s465, s300, s216). This also ensures the system can expand in the future, if we then provide a versioned placeholder image. This is in line with what we do for svg images elsewhere, which only generate one asset variant.

Note on `FeaturedImageData` changes:
- I had to compute a `sources` payload for the `FeaturedImageData` since that's the model underlying the fallback organisation image. The `publishing_api_details` method sits on the `Image` model for regular images, so it would have made sense to put it on the "parent" model for `FeaturedImageData` as well, i.e. `Organisation` in this case. Nonetheless, there are many models using this `_Data` class, not just `Organisation`, so it is more convenient to place it straight on the `FeaturedImageData` for the time being.
- We can reconsider this at a later stage when more `FeatureImageData` usages need to be made consistent with this new payload shape, so I have made no attempts to unify concerns at this point.
@ChrisBAshton ChrisBAshton force-pushed the support-lead-image-opt-out branch 2 times, most recently from 55ef0c7 to c8a6692 Compare March 10, 2026 13:12
When editions are created and they get the default lead image,
the link to 'Add' a lead image is a little confusing, as there is
already one - the default.

The designs in the ticket suggest we use the word 'Replace'
instead.
We're about to make the logic more complex, so let's set a good
foundation to iterate from.
@ChrisBAshton ChrisBAshton force-pushed the support-lead-image-opt-out branch from c8a6692 to 1004b80 Compare March 10, 2026 13:27
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

Successfully merging this pull request may close these issues.

2 participants