Handle gallery affiliate links for dcar#28122
Merged
marjisound merged 3 commits intomainfrom Aug 1, 2025
Merged
Conversation
Contributor
The GalleryCaptionCleaner used by twirl template is adding a class that is not needed for dcr, therefore, a separate cleaner is added to handle the dcr case.
90ac628 to
1018711
Compare
emma-imber
reviewed
Jul 29, 2025
emma-imber
approved these changes
Jul 30, 2025
arelra
approved these changes
Jul 31, 2025
Member
arelra
left a comment
There was a problem hiding this comment.
Thanks for separating out the DCR related gallery code from the existing Frontend logic. This will make the task of deleting Frontend code much easier
|
Seen on ADMIN-PROD (merged by @marjisound 9 minutes and 57 seconds ago)
|
|
Seen on FRONTS-PROD (merged by @marjisound 12 minutes and 11 seconds ago)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
Looking into the frontend version of the Gallery affiliate links, there are three main tasks that need to be completed for DCR migration.
showAffiliateLinksfield,alwaysOffTagsconfig & tagsNote:
In
galleryBodytwirl template theGalleryCaptionCleanersis used for every image item to clean the caption. There are 2 cleaners involved:<br>tags<strong>and wraps it with<h2>element<strong>elementh2at the start of the captionshouldAddAffiliateLinksfunction and then replaces affiliate links with Simlinks if necessarySome updates:
I’ve re-created the two cleaners for the DCR model with adjustments:
gallery__caption__titleclass for DCR.shouldAddAffiliateLinkscheck, which was previously applied to every image item, is no longer needed since the result of this check is already available in the DotcomRenderingDataModel. Instead the parapetershouldAddAffiliateLinksis used in the new cleanerRelevant DCAR PR: guardian/dotcom-rendering#14303
Fixes #12292