bodyHtmlEnd
Environment: server.
Implemented by: vike-vue
/vike-react
.
You need
vike-vue
/vike-react
to be able to usebodyHtmlEnd
.
The settings bodyHtmlEnd
/bodyHtmlBegin
enable you to insert HTML at the beginning/end of the <body>
tag.
For use cases, such as adding
<script>
tags, you can also use<Head>
or+client.js
.
⚠️Be cautious about the security risk called XSS injections.
Vue
When using Vue, it's usually used for adding the HTML targets of teleports.
Teleports work out of the box when using <Teleport to="teleported">
and you don't have to use bodyHtml{Begin,End}
then.
vike-vue
always inserts this at the end of the<body>
tag:
You can use Vike's
pageContext
object to access Vue'sssrContext
object:
Global
This setting is global: its value always applies to all your pages. In other words, it doesn't support config inheritance.
You cannot set it at
pages/some-page/+config.js
: you have to set it atpages/+config.js
(or some other global location) instead.
If you want to set different values for different pages, then consider creating a custom setting as shown at Guides >
<head>
tags > Custom settings.