Skip to content

Affiliate links - consistent rel attribute#15976

Merged
andrewHEguardian merged 6 commits into
mainfrom
ahe/skimlink-rel-attribute
May 27, 2026
Merged

Affiliate links - consistent rel attribute#15976
andrewHEguardian merged 6 commits into
mainfrom
ahe/skimlink-rel-attribute

Conversation

@andrewHEguardian
Copy link
Copy Markdown
Contributor

@andrewHEguardian andrewHEguardian commented May 26, 2026

What does this change?

Updates all affiliate (skimlinks) links to use the attribute rel="sponsored noopener noreferer". We already use this value on the product link button.

Why?

We are testing this exact value in our e2e tests assuming we'll find a product link button. This caused a failure when the article was updated to include a skimlink in the opening body text. Making this consistent means the tests don't have to rely on the order in which the links might appear, and is correct as we should be applying the same attributes to all skimlinks.

Screenshots

Before After
image image

@github-actions
Copy link
Copy Markdown

Hello 👋! When you're ready to run Chromatic, please apply the run_chromatic label to this PR.

You will need to reapply the label each time you want to run Chromatic.

Click here to see the Chromatic project.

@andrewHEguardian andrewHEguardian added the fix Departmental tracking: fix label May 26, 2026
*/
rel: isSkimlink(href)
? 'sponsored'
? 'sponsored noreferrer noopener'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about a single utility function that provides this value so it is not duplicated e.g.

Suggested change
? 'sponsored noreferrer noopener'
? getSkimLinkRel()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, any reason for it to be a function rather than a const?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point it could be a const

Copy link
Copy Markdown
Member

@arelra arelra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the improvement 👍

Copy link
Copy Markdown
Contributor

@charleycampbell charleycampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

@andrewHEguardian andrewHEguardian added maintenance Departmental tracking: maintenance work, not a fix or a feature and removed fix Departmental tracking: fix labels May 27, 2026
@andrewHEguardian andrewHEguardian merged commit 69830ab into main May 27, 2026
62 of 68 checks passed
@andrewHEguardian andrewHEguardian deleted the ahe/skimlink-rel-attribute branch May 27, 2026 14:16
@gu-prout
Copy link
Copy Markdown

gu-prout Bot commented May 27, 2026

Overdue on PROD (merged by @andrewHEguardian 30 minutes and 8 seconds ago) What's gone wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Departmental tracking: maintenance work, not a fix or a feature Overdue-on-PROD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants