We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I want to add structured data to my app. Therefore I have to insert some JSON-LD to the head of my page layout as follows
<html> <head> <script type="application/ld+json"> { "@context": "https://json-ld.org/contexts/person.jsonld", "@id": "http://dbpedia.org/resource/John_Lennon", "name": "John Lennon", "born": "1940-10-09", "spouse": "http://dbpedia.org/resource/Cynthia_Lennon" } </script> ...
According to the documentation and the linked source this is how it is done:
module.exports = { head: [ ['script', { type: 'application/ld+json' }, '{"@context": "https://json-ld.org/contexts/person.jsonld", "@id": "http://dbpedia.org/resource/John_Lennon", "name": "John Lennon", "born": "1940-10-09", "spouse": "http://dbpedia.org/resource/Cynthia_Lennon"}'] ] }
But this will fail with the following message:
✖ rendering pages... build error: Error: Transform failed with 1 error: inline-script.js:1:11: error: Expected ";" but found ":" at failureErrorWithLog (/home/raymond/Sites/website-next/node_modules/esbuild/lib/main.js:1493:15) at /home/raymond/Sites/website-next/node_modules/esbuild/lib/main.js:1282:29 at /home/raymond/Sites/website-next/node_modules/esbuild/lib/main.js:629:9 at handleIncomingPacket (/home/raymond/Sites/website-next/node_modules/esbuild/lib/main.js:726:9) at Socket.readFromStdout (/home/raymond/Sites/website-next/node_modules/esbuild/lib/main.js:596:7) at Socket.emit (events.js:400:28) at addChunk (internal/streams/readable.js:293:12) at readableAddChunk (internal/streams/readable.js:267:9) at Socket.Readable.push (internal/streams/readable.js:206:10) at Pipe.onStreamRead (internal/stream_base_commons.js:188:23) { errors: [ { detail: undefined, location: [Object], notes: [], pluginName: '', text: 'Expected ";" but found ":"' } ], warnings: [], frame: '\n' + '\x1B[33mExpected ";" but found ":"\x1B[39m\n' + '1 | {"@context": "https://json-ld.org/contexts/person.jsonld", "@id": "http://dbpedia.org/resource/John_Lennon", "name": "John Lennon", "born": "1940-10-09", "spouse": "http://dbpedia.org/resource/Cynthia_Lennon"}\n' + ' | ^\n', loc: { column: 11, file: 'inline-script.js', length: 1, line: 1, lineText: '{"@context": "https://json-ld.org/contexts/person.jsonld", "@id": "http://dbpedia.org/resource/John_Lennon", "name": "John Lennon", "born": "1940-10-09", "spouse": "http://dbpedia.org/resource/Cynthia_Lennon"}', namespace: '', suggestion: '' } } error Command failed with exit code 1.
Try to add a <script> tag the head that consists of non-javascript content. For example:
<script>
module.exports = { head: [ ['script', { type: 'application/ld+json' }, '{ "foo": "bar" }'] ] }
I expect that the defined <script> tag will be added to my sites head.
System: OS: Linux 5.13 Ubuntu 20.04.3 LTS (Focal Fossa) CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz Memory: 10.35 GB / 23.13 GB Container: Yes Shell: 5.8 - /usr/bin/zsh Binaries: Node: 14.18.3 - ~/.nvm/versions/node/v14.18.3/bin/node Yarn: 1.22.17 - ~/Sites/website-next/node_modules/.bin/yarn npm: 6.14.15 - ~/.nvm/versions/node/v14.18.3/bin/npm Browsers: Chromium: 98.0.4758.80 Firefox: 97.0 npmPackages: vitepress: ^0.21.6 => 0.21.6
I already proposed a bug fix: #517
The text was updated successfully, but these errors were encountered:
fix: should not parse JSON-LD script in head (fix vuejs#538)
9bee9a2
779b789
No branches or pull requests
Describe the bug
I want to add structured data to my app. Therefore I have to insert some JSON-LD to the head of my page layout as follows
According to the documentation and the linked source this is how it is done:
But this will fail with the following message:
Reproduction
Try to add a
<script>
tag the head that consists of non-javascript content. For example:Expected behavior
I expect that the defined
<script>
tag will be added to my sites head.System Info
Additional context
I already proposed a bug fix: #517
Validations
The text was updated successfully, but these errors were encountered: