docs: add head `<script>` example (#2264)

Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
pull/2320/head
李鹏坤-执手对影成双 2 years ago committed by GitHub
parent 64ecedc73f
commit 3b3bfea94c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -94,6 +94,7 @@ export default {
title: 'My Awesome Site'
}
```
```md
# Hello
```
@ -113,6 +114,7 @@ export default {
titleTemplate: 'Custom Suffix'
}
```
```md
# Hello
```
@ -159,8 +161,29 @@ export default {
[
'link',
{ rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' }
// would render:
//
// <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
],
[
'script',
{ id: 'register-sw' },
`;(() => {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js')
}
})()`
// would render:
//
// <script id="register-sw">
// ;(() => {
// if ('serviceWorker' in navigator) {
// navigator.serviceWorker.register('/sw.js')
// }
// })()
// </script>
]
// would render: <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
]
}
```
@ -295,7 +318,7 @@ export default {
}
```
It can also be an array of extact url string, regex patterns, or custom filter functions.
It can also be an array of exact url string, regex patterns, or custom filter functions.
```ts
export default {

Loading…
Cancel
Save