Is there a way to embed a script from external source as well as local script into Vitepress markdown for it to be generated?
This example
## my test button
<script src=";></script>
<script>
function initButton() {
...
}
</script>
throws up an issue
[vite] hmr update /test/index.md (x2) 19:00:17 [vite] Internal server error: Tags with side effect ( and ) are ignored in client ponent templates. Plugin: vite:vue
Is there a way to embed a script from external source as well as local script into Vitepress markdown for it to be generated?
This example
## my test button
<script src="https://www.jsdeliver./sdk/js?yadayada"></script>
<script>
function initButton() {
...
}
</script>
throws up an issue
Share Improve this question edited Feb 24, 2023 at 19:59 isherwood 61.2k16 gold badges121 silver badges170 bronze badges asked Jan 12, 2022 at 19:02 mirageglobemirageglobe 3,1542 gold badges32 silver badges31 bronze badges[vite] hmr update /test/index.md (x2) 19:00:17 [vite] Internal server error: Tags with side effect ( and ) are ignored in client ponent templates. Plugin: vite:vue
1 Answer
Reset to default 8a first possible way is through the config file (.vitepress/config.js) which is possible embed the scripts into the generated vitepress index.html. the documentation doesnt explain it well but this works if we need to place scripts into header.
the following is an example of google tag header script.
export default {
title: 'mydocumentation',
head: [
[
'script',
{
async: true,
src: 'https://www.googletagmanager./gtag/js?id=G-xxxxxxxxx'
}
],
[
'script',
{},
`
window.dataLayer = window.dataLayer || [];
...
gtag('config', 'G-xxxxxxxxxxx');
`
]
]
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745109076a4611738.html
评论列表(0条)