-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathapp.vue
More file actions
63 lines (56 loc) · 1.39 KB
/
app.vue
File metadata and controls
63 lines (56 loc) · 1.39 KB
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
<template>
<nuxt-layout>
<nuxt-page />
</nuxt-layout>
</template>
<script setup lang="ts">
import { useFavicon, usePreferredDark } from "@vueuse/core";
import getPostDigest from "~/utils/getPostDigests";
import getSiteName from "~/utils/getSiteName.js";
const route = useRoute();
const postname = computed(() => route.params.postname as string);
const sitename = getSiteName();
const titleWithPrefix = computed(() => {
if (route.params.postname) {
return `${sitename} - ${getPostDigest(postname.value)?.title}`
}
return `${sitename} - ${route.meta.title}`;
});
const titleWithSuffix = computed(() => {
if (route.params.postname) {
return `${getPostDigest(postname.value)?.title} - ${sitename}`
}
return `${route.meta.title} - ${sitename}`;
});
onMounted(() => {
const isDark = usePreferredDark();
useFavicon('/avatar.jpg', {
rel: 'icon'
})
});
useHead({
meta: [
{
property: 'og:title',
content: titleWithPrefix
}
],
link: [
{
rel: 'preconnect',
href: 'https://rsms.me/'
},
{
rel: 'stylesheet',
href: 'https://rsms.me/inter/inter.css'
},
{
rel: 'stylesheet',
href: 'https://cdn.jsdelivr.net/npm/katex@0.16.27/dist/katex.min.css',
integrity: 'sha384-Pu5+C18nP5dwykLJOhd2U4Xen7rjScHN/qusop27hdd2drI+lL5KvX7YntvT8yew',
crossorigin: 'anonymous'
}
],
title: titleWithSuffix,
})
</script>