Skip to content

fix: scope alternate link dedupeKey by href when type is used#760

Merged
harlan-zw merged 1 commit into
v2from
fix/dedupe-alternate-href-v2
May 8, 2026
Merged

fix: scope alternate link dedupeKey by href when type is used#760
harlan-zw merged 1 commit into
v2from
fix/dedupe-alternate-href-v2

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

Backport of #759 to the v2 branch.

Problem

Multiple RSS/Atom <link rel="alternate"> tags sharing the same type but with different href values were being collapsed into one tag, because dedupeKey for alternates was built from type alone.

Fix

Use hreflang alone as the key when present (language variants are uniquely identified by it). For type-based alternates, include href in the key so distinct feeds are not conflated.

if (name === 'link' && props.rel === 'alternate') {
  if (props.hreflang)
    return `alternate:${props.hreflang}`
  if (props.type)
    return `alternate:${props.type}:${props.href || ''}`
}

Fixes #758

Backport of #759 to v2.

Multiple RSS/Atom alternate links sharing the same `type` but with
different `href` values were being collapsed into one tag because the
dedupe key was built from `type` alone. Include `href` in the key for
type-based alternates so distinct feeds are preserved. `hreflang`
precedence is unchanged.

Fixes #758
@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7d01fbfa-fd94-4d19-b263-9eee423479b0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/dedupe-alternate-href-v2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@harlan-zw harlan-zw changed the title fix(dedupe): scope alternate link dedupeKey by href when type is used (v2 backport) fix: scope alternate link dedupeKey by href when type is used May 8, 2026
@harlan-zw harlan-zw merged commit 10846b5 into v2 May 8, 2026
1 check passed
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.

1 participant