Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate canonical tags when specifying in frontmatter.head #2153

Closed
1 task done
mktbsh opened this issue Jul 26, 2024 · 0 comments · Fixed by #2154
Closed
1 task done

Duplicate canonical tags when specifying in frontmatter.head #2153

mktbsh opened this issue Jul 26, 2024 · 0 comments · Fixed by #2154

Comments

@mktbsh
Copy link
Contributor

mktbsh commented Jul 26, 2024

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.
mktbsh added a commit to mktbsh/starlight that referenced this issue Jul 26, 2024
delucis added a commit that referenced this issue Jul 27, 2024
HiDeoo added a commit to HiDeoo/starlight that referenced this issue Aug 6, 2024
* main: (275 commits)
  [ci] release (withastro#2165)
  Define well-known RTL locales before calling `getLocaleInfo()` for default locale (withastro#2167)
  Update dependencies (withastro#2166)
  Improve page load performance (withastro#2155)
  docs: Add CodeSweetly to showcase (withastro#2160)
  [ci] release (withastro#2145)
  Fix bug for projects with spaces in their pathname (withastro#2156)
  ci: update file icons (withastro#2157)
  [ci] format
  Merge <link rel="canonical" /> tags, quick fixes (withastro#2153) (withastro#2154)
  Add two new showcase sites (withastro#2149)
  [ci] format
  i18n(zh-cn): Update `environmental-impact.md` (withastro#2148)
  add Saasfly showcase (withastro#2147)
  docs: add 'og:image:alt' metadata (withastro#2143)
  Deleting unnecessary twitter meta tags, quick fixes (withastro#2137)
  [ci] format
  i18n(es): update `environmental-impact` (withastro#2144)
  [ci] release (withastro#2142)
  feat: Add Pinterest icon to social list (withastro#2135)
  ...
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 a pull request may close this issue.

1 participant