svelte-meta-tags
svelte-meta-tags copied to clipboard
`<JsonLd>` is duplicated in the `<head>`
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"
}
}
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: https://github.com/sveltejs/svelte/issues/7444
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.
Svelte v3.52.0 finally fixes this issue!