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

Two JSON-LD tags #8802

Closed
shuaixr opened this issue Jan 31, 2023 · 2 comments
Closed

Two JSON-LD tags #8802

shuaixr opened this issue Jan 31, 2023 · 2 comments

Comments

@shuaixr
Copy link

shuaixr commented Jan 31, 2023

Describe the bug

Sveltekit generates two JSON-LD tags when configured with a domain in a production environment, here's a comparison between the domain and non-domain versions: http://45.56.85.226:3000/ and https://jsonld.shuaixr.xyz/

8ron3.png

When JavaScript is turned off in the browser, one of the JSON-LD tags disappears, so I didn't pay too much attention to it initially. However, recently I found that there were also two in Googlebot's crawled pages.

Also, I wrote a Svelte component like this for easy use of JSON-LD:

<script lang="ts">
	export let json_ld: unknown;
</script>

<svelte:head
	>{@html `
    <script type="application/ld+json">
            ${JSON.stringify(json_ld)}
    </script>`}
</svelte:head>

I am a beginner, this error may also be caused by my non-standard svelte component. If so, please inform me of the correct way.
I created a repository to reproduce the bug where there is all the code:https://github.com/shuaixr/jsonld_svelte
I created a website deployment of this repository:
https://jsonld.shuaixr.xyz

Reproduction

1.clone https://github.com/shuaixr/jsonld_svelte
2.npm run build
3.export PROTOCOL_HEADER=x-forwarded-proto && export HOST_HEADER=x-forwarded-host
3.node build/index.js

Logs

Listening on 0.0.0.0:3000

System Info

System:
    OS: Linux 5.10 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
    CPU: (1) x64 AMD EPYC 7542 32-Core Processor
    Memory: 374.07 MB / 976.58 MB
    Container: Yes
    Shell: 5.1.4 - /bin/bash
  Binaries:
    Node: 18.12.1 - /usr/bin/node
    npm: 8.19.2 - /usr/bin/npm
  npmPackages:
    @sveltejs/adapter-auto: ^1.0.2 => 1.0.2
    @sveltejs/adapter-node: ^1.1.4 => 1.1.4
    @sveltejs/kit: ^1.0.0 => 1.3.1
    svelte: ^3.54.0 => 3.55.1
    vite: ^4.0.0 => 4.0.4

Severity

annoyance

Additional Information

No response

@eltigerchino
Copy link
Member

eltigerchino commented Jan 31, 2023

Possibly related to sveltejs/svelte#8112
Which should have been fixed by sveltejs/svelte#7745

Can you try updating the svelte package and see if this still occurs?

@shuaixr
Copy link
Author

shuaixr commented Jan 31, 2023

Possibly related to sveltejs/svelte#8112 Which should have been fixed by sveltejs/svelte#7745

Can you try updating the svelte package and see if this still occurs?

The error disappeared when I updated @svelte/kit to version 1.3.6. Thank you.

@shuaixr shuaixr closed this as completed Jan 31, 2023
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

No branches or pull requests

2 participants