-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.vue
53 lines (45 loc) · 1.27 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
<template>
<nuxt-loading-indicator color="#1de9b6" :throttle="0"/>
<nuxt-layout>
<nuxt-page/>
</nuxt-layout>
</template>
<script setup>
import {useFavicon, usePreferredDark} from "@vueuse/core";
import getPostContent from "~/utils/getPostContent.js";
import getSiteName from "~/utils/getSiteName.js";
const route = useRoute();
const sitename = getSiteName();
const titleWithPrefix = computed(() => `${sitename} - ${route.meta.title}`);
const titleWithSuffix = computed(() => {
if (route.params.postname) {
return `${getPostContent(route.params.postname).title} - ${sitename}`
}
return `${route.meta.title} - ${sitename}`;
});
const darkClass = computed(() => (forceMode.value === 'dark' || (darkMode.value && forceMode.value !== 'light')) ? 'dark' : '')
const darkModeCookie = useCookie('subilan-blog-dark-mode-indicator');
const darkMode = usePreferredDark();
const forceMode = useState('force-mode', () => darkModeCookie.value || '');
useHead({
meta: [
{
property: 'og:title',
content: titleWithPrefix
}
],
title: titleWithSuffix,
htmlAttrs: {
class: darkClass
}
})
onMounted(() => {
const isDark = usePreferredDark();
useFavicon('/avatar.jpg', {
rel: 'icon'
})
})
</script>
<style lang="scss">
@use '@/assets/global';
</style>