Skip to content

Duplicate canonical tags when specifying in frontmatter.head #2153

@mktbsh

Description

@mktbsh

What version of starlight are you using?

0.25.2

What version of astro are you using?

4.10.2

What package manager are you using?

pnpm

What operating system are you using?

Mac

What browser are you using?

Chrome

Describe the Bug

Thank you for providing an awesome Astro theme.

I've encountered an issue where specifying a canonical tag in the frontmatter.head results in two canonical tag specifications in the HTML output.

This duplication of canonical tags can potentially cause confusion for search engines and impact SEO performance.

Steps to reproduce:

  • Add a canonical tag specification in head field of frontmatter
  • npm run dev or npm run build
  • Inspect the resulting HTML

Expected behavior:
Only one canonical tag should be present in the HTML output.

Actual behavior:
Two canonical tags are present in the HTML output:

  • One from the frontmatter.head specification
  • Another potentially generated by the system

Possible solutions:

  • Implement a check to prevent duplicate canonical tags

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-8dz9uz?file=src%2Fcontent%2Fdocs%2Findex.mdx

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions