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

<JsonLd> is duplicated in the <head> #372

Closed
ReindDooyeweerd opened this issue Jun 30, 2022 · 3 comments
Closed

<JsonLd> is duplicated in the <head> #372

ReindDooyeweerd opened this issue Jun 30, 2022 · 3 comments
Labels
blocked by upstream bug Something isn't working

Comments

@ReindDooyeweerd
Copy link

After adding the following code block (just a copy of the example) and inspecting the page the JsonLd seems to be inserted twice. When switching the output to body it inserts it once.

The code block,

<JsonLd
  schema={{
    '@type': 'Article',
    mainEntityOfPage: {
      '@type': 'WebPage',
      '@id': 'https://example.com/article',
    },
    headline: 'Article headline',
    image: [
      'https://example.com/photos/1x1/photo.jpg',
      'https://example.com/photos/4x3/photo.jpg',
      'https://example.com/photos/16x9/photo.jpg',
    ],
    datePublished: '2015-02-05T08:00:00+08:00',
    dateModified: '2015-02-05T09:20:00+08:00',
    author: {
      '@type': 'Person',
      name: 'John Doe',
    },
    publisher: {
      '@type': 'Organization',
      name: 'Google',
      logo: {
        '@type': 'ImageObject',
        url: 'https://example.com/logo.jpg',
      },
    },
  }}
/>

The actual result https://share.cleanshot.com/wAGeiykgk9BqhD7My5iP

My package.json,

{
  "name": "frontend",
  "version": "0.0.1",
  "scripts": {
    "dev": "env-cmd svelte-kit dev",
    "build": "svelte-kit build",
    "package": "svelte-kit package",
    "preview": "env-cmd svelte-kit preview",
    "prepare": "svelte-kit sync",
    "lint": "prettier --check --plugin-search-dir=. . && eslint .",
    "format": "prettier --write --plugin-search-dir=. ."
  },
  "devDependencies": {
    "@fullhuman/postcss-purgecss": "^4.1.3",
    "@sveltejs/adapter-node": "^1.0.0-next.78",
    "@sveltejs/kit": "next",
    "bootstrap": "^5.2.0-beta1",
    "cssnano": "^5.1.12",
    "env-cmd": "^10.1.0",
    "eslint": "^8.18.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-svelte3": "^4.0.0",
    "graphql-request": "^4.3.0",
    "postcss-load-config": "^4.0.1",
    "postcss-sort-media-queries": "^4.2.1",
    "prettier": "^2.7.1",
    "prettier-plugin-svelte": "^2.7.0",
    "sass": "^1.53.0",
    "stylelint-config-rational-order": "^0.1.2",
    "stylelint-config-standard": "^26.0.0",
    "stylelint-config-standard-scss": "^4.0.0",
    "stylelint-order": "^5.0.0",
    "stylelint-scss": "^4.2.0",
    "svelte": "^3.48.0",
    "svelte-body": "^1.3.6",
    "svelte-meta-tags": "^2.6.1",
    "svelte-preprocess": "^4.10.7",
    "svelte-recaptcha-v2": "^0.0.2"
  },
  "type": "module",
  "dependencies": {
    "@sendgrid/mail": "^7.7.0",
    "embla-carousel": "^6.2.0",
    "postcss-scss": "^4.0.4"
  }
}
@ReindDooyeweerd ReindDooyeweerd added the bug Something isn't working label Jun 30, 2022
@oekazuma
Copy link
Owner

This is a bug in Svelte. So unless Svelte fixes it, it cannot be resolved....

Since this issue is often opened, I will leave this issue open until it is resolved.

Related Issues: sveltejs/svelte#7444

@oekazuma oekazuma changed the title JsonLd appears twice in the head <JsonLd > is duplicated in the <head> Jun 30, 2022
@oekazuma oekazuma changed the title <JsonLd > is duplicated in the <head> <JsonLd> is duplicated in the <head> Jun 30, 2022
@VisionaryAppDev
Copy link

Seem like I got this issue as well. Today, I just got an error in the Google Search console that there is some duplication related to my JsonLd. The thing is, I couldn't find any duplication when inspect my source code in browser view-source (view-source:https://www.eztools.io). But, when I tried Google Rich Results Test and Schema Markup Validator, they just detect it out of no where.

@oekazuma
Copy link
Owner

oekazuma commented Oct 16, 2022

Svelte v3.52.0 finally fixes this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked by upstream bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants