Fix blog post title

This commit is contained in:
2021-04-18 14:32:12 +02:00
parent 99c2727ae6
commit 6da0d9df02

View File

@@ -111,7 +111,7 @@ import {
useContext,
useFetch,
useMeta,
useRoute, useStatic
useRoute, useStatic, watch
} from "@nuxtjs/composition-api";
import {Post} from "../../../@types/types";
@@ -121,6 +121,7 @@ export default defineComponent({
setup() {
const {$content, i18n, $axios, app, $storage} = useContext()
const route = useRoute()
const { title } = useMeta()
const slug = computed(() => route.value.params.slug)
const post = useStatic((slug) => {
@@ -131,8 +132,8 @@ export default defineComponent({
}) as Promise<Post>
}, slug, 'post')
useMeta({
title: `Blog - Arthur Danjou - ${post.value?.title}`
watch(post, () => {
title.value = `Blog - Arthur Danjou - ${post.value?.title || 'Loading title...'}`
})
const liked = ref($storage.getCookie(`${slug.value}`) !== undefined)