-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
SEO Support LD+JSON in head #785
Comments
I believe this is an error coming from https://github.com/sveltejs/svelte-preprocess and that that library is being asked to transform all scripts, and it can't find an appropriate way to do so with that script. Before parsing, the Svelte compiler can't tell which @kaisermann Is there a way to make svelte-preprocess more careful about which script types it attempts to preprocess? I'm not sure where the call to svelte-preprocess lives (maybe in the Svelte Vite plugin?), but is there something we could or should do there so that svelte-preprocess doesn't try to convert things it doesn't know how to? |
Oh. The call to svelte-preprocess lives right in |
I believed that since it's within the Alternatively, there could be another tag that injects the code as it is, without getting through the preprocessor. |
You can use the Closing as a duplicate of sveltejs/svelte-preprocess#305 |
Describe the bug
When inserting structured information, for SEO purpose, into the head of a page in
ld+json
format, this is not possible. Instead, by omitting the type of the script, this renders with no visible error.Logs
The error I get from
vite
in my browserTo Reproduce
I'm using the latest available version of
kit
.Simply add to one of the pages the following snippet
Expected behavior
The expected behavior is to be able to specify the
type
of a script (at least, in this format)Stacktraces
If you have a stack trace to include, we recommend putting inside a
<details>
block for the sake of the thread's readability:Stack trace
Cannot find module './transformers/ld+json'
Require stack:
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at /path/to/folder/ui/node_modules/svelte-preprocess/dist/autoProcess.js:36:77
at async Object.transform (/path/to/folder/ui/node_modules/svelte-preprocess/dist/autoProcess.js:36:29)
at async /path/to/folder/ui/node_modules/svelte-preprocess/dist/autoProcess.js:109:29
at async script (/path/to/folder/ui/node_modules/svelte-preprocess/dist/autoProcess.js:137:33)
at async process_single_tag (/path/to/folder/ui/node_modules/svelte/compiler.js:30147:28
Click outside or fix the code to dismiss.
You can also disable this overlay with hmr: { overlay: false } in vite.config.js.
Information about your SvelteKit Installation:
npx envinfo --system --npmPackages svelte,@sveltejs/kit --binaries --browsers
Your browser
Brave Browser Version 1.21.76 Chromium: 89.0.4389.86 (Official Build) (64-bit)
Your adapter (e.g. Node, static, Vercel, Begin, etc...)
Plain node at the moment, since I'm still developing and discovering kit
Severity
How severe an issue is this bug to you? Is this annoying, blocking some users, blocking an upgrade or blocking your usage of SvelteKit entirely?
Note: the more honest and specific you are here the more we will take you seriously.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: