-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.vue
70 lines (63 loc) · 2.68 KB
/
app.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<template>
<SpeedInsights />
<NuxtPage />
</template>
<script setup lang="ts">
import { SpeedInsights } from "@vercel/speed-insights/nuxt"
const darkOrLight = ref(isDark() ? 'dark' : 'light');
if (process.browser) {
watch(darkOrLight, () => {
document.body.dataset.bsTheme = darkOrLight.value;
});
}
provide('darkOrLight', darkOrLight);
const router = useRouter();
onMounted(() => {
console.log('mounted app');
initAd();
})
function renderHead() {
const { page } = useContent();
const _imgPath = computed(() => page.value && page.value.thumbnail && getImgRelativePath(decodeURIComponent(page.value.thumbnail), page.value._file));
const img = useImage();
const imgPath = computed(() =>
_imgPath.value &&
((new URL(img(_imgPath.value, { width: 1200, height: 630 }), HOST)) ?? '').toString());
useHead({
htmlAttrs: { lang: 'ja' },
title: page.value.title ? `${page.value.title} - aqz/tamaina's homepage` : `a9z.dev - aqz/tamaina's homepage`,
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width,initial-scale=1' },
...(imgPath.value ? [
{ property: 'og:image', content: imgPath.value },
{ name: 'twitter:card', content: 'summary_large_image' },
{ name: 'twitter:image', content: imgPath.value },
] : [
{ name: 'twitter:card', content: 'summary' },
]),
{ property: 'og:title', content: page.value.title },
{ property: 'description', content: page.value.description },
{ property: 'og:description', content: page.value.description },
],
link: [
{ rel: 'stylesheet', href: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css' },
{ rel: 'stylesheet', href: 'https://cdn.jsdelivr.net/gh/tamaina/[email protected]/dist/GenEiUniverSans/GenEiUniverSans.css' },
{ rel: 'stylesheet', href: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/yakuhanjp.min.css' },
{ rel: 'stylesheet', href: 'https://cdn.jsdelivr.net/gh/tamaina/[email protected]/dist/SourceHanSans/SourceHanSans.css' },
{ rel: 'stylesheet', href: 'https://cdn.jsdelivr.net/gh/tamaina/[email protected]/dist/NasuM/NasuM.css' },
],
script: [
{ src: '/boot.js', async: true },
{ src: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js' },
],
bodyAttrs: {
'data-bs-theme': darkOrLight.value,
}
});
}
router.afterEach(() => {
renderHead();
});
renderHead();
</script>