2023-03-10 08:01:21 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
const description = ref('head script setup description for %site.name')
|
|
|
|
const siteName = ref()
|
|
|
|
// server meta
|
|
|
|
useServerSeoMeta({
|
|
|
|
description,
|
|
|
|
ogDescription: description,
|
|
|
|
ogImage: '%site.url/og-image.png',
|
|
|
|
ogTitle: '%s %separator %site.name',
|
|
|
|
ogType: 'website',
|
2024-04-05 18:08:32 +00:00
|
|
|
ogUrl: '%site.url/head-script-setup',
|
2023-03-10 08:01:21 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
useServerHead({
|
|
|
|
style: [
|
|
|
|
'/* Custom styles */',
|
2024-04-05 18:08:32 +00:00
|
|
|
'h1 { color: salmon; }',
|
|
|
|
],
|
2023-03-10 08:01:21 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
useHead({
|
|
|
|
title: 'head script setup',
|
|
|
|
titleTemplate: '%s %separator %site.name',
|
|
|
|
templateParams: {
|
|
|
|
separator: () => '-',
|
|
|
|
site: {
|
|
|
|
url: 'https://example.com',
|
2024-04-05 18:08:32 +00:00
|
|
|
name: siteName,
|
|
|
|
},
|
|
|
|
},
|
2023-03-10 08:01:21 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
useHeadSafe({
|
|
|
|
script: [
|
|
|
|
{
|
|
|
|
id: 'xss-script',
|
|
|
|
// @ts-expect-error not allowed
|
2024-04-05 18:08:32 +00:00
|
|
|
innerHTML: 'alert("xss")',
|
|
|
|
},
|
2023-03-10 08:01:21 +00:00
|
|
|
],
|
|
|
|
meta: [
|
|
|
|
{
|
|
|
|
// @ts-expect-error not allowed
|
|
|
|
'http-equiv': 'refresh',
|
2024-04-05 18:08:32 +00:00
|
|
|
'content': '0;javascript:alert(1)',
|
|
|
|
},
|
|
|
|
],
|
2023-03-10 08:01:21 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
siteName.value = 'Nuxt Playground'
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<h1>head script setup</h1>
|
|
|
|
</div>
|
|
|
|
</template>
|