question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

De-duplication of meta tags in head

See original GitHub issue

Is your feature request related to a problem? Please describe. If you declare tags in the _layout.svelte, and then declare the same tag in a page’s <svelte:head>, the tags are appended.

This is fine for some cases, but if I want a global meta tag across the whole site, and then specific meta tags for specific pages, I can’t do it, because in those pages I get both tags.

Describe the solution you’d like If I was able to declare a unique attribute on a tag, which indicated to the child component that this tag should be replaced, and was not in addition to the tag from _layout, this would be ideal.

Describe alternatives you’ve considered Another alternative is that we can define an ID on meta tags, which would have the same purpose. The newest tag would be used for the head, and the old one replaced.

How important is this feature to you? Very High - it makes SEO really very difficult to get right with Sapper / Svelte.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:13
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
s-kriscommented, Sep 1, 2021

This needs to be fixed. React-Helmet overrides as per the deepest tag in the hierarchy.

2reactions
tx0ccommented, Aug 12, 2022

this needs to be fixed: Svelte needs a way to be able de-duplicate meta headers

fyi: https://nextjs.org/docs/api-reference/next/head

      <Head>
        <title>My page title</title>
        <meta property="og:title" content="My page title" key="title" />
      </Head>
      <Head>
        <meta property="og:title" content="My new title" key="title" />
      </Head>

In this case only the second <meta property="og:title" /> is rendered. meta tags with duplicate key attributes are automatically handled.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - How to avoid duplicated meta tags? - Stack Overflow
I'm developing my website with next.js. My Question. The code below is in _document.js Head component. These are root meta tags. < ...
Read more >
How do I fix duplicate meta tags? - Yoast
If you have multiple unique URLs with the same meta tags, you may decide to: Change the title of pages to distinguish between...
Read more >
Dynamically Generating Meta Tags in Next.js
Each tag has a key prop which handles deduplication. calling getServerSideProps inside the relevant page. Explanation: _document.
Read more >
URL Canonicalization and the Canonical Tag | Documentation
When a site has duplicate content, Google chooses the canonical URL. Learn more about canonical URLs and how to consolidate duplicate URLs.
Read more >
How to Set Up and Install the Meta Pixel - Facebook
If you already set up your Meta Pixel using IMG tags or plan to do so, we recommend that you follow our developer...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found