2022-10-16 09:37:13 +00:00
|
|
|
<template>
|
|
|
|
<NuxtLayout name="blog">
|
2022-10-16 11:04:03 +00:00
|
|
|
<Head>
|
|
|
|
<Meta name="description" :content="preview" />
|
|
|
|
<Meta property="og:type" content="article" />
|
2022-12-04 10:12:29 +00:00
|
|
|
<Meta property="og:title" :content="post?.title || ''" />
|
2022-10-16 11:04:03 +00:00
|
|
|
<Meta
|
|
|
|
property="og:url"
|
2022-12-04 10:12:29 +00:00
|
|
|
:content="'https://lunasqu.ee/blog/' + post?.fullSlug || ''"
|
2022-10-16 11:04:03 +00:00
|
|
|
/>
|
|
|
|
<Meta property="og:site_name" content="Evert's Blog" />
|
|
|
|
<Meta property="og:description" :content="preview" />
|
|
|
|
<Meta property="og:locale" content="en_US" />
|
|
|
|
<Meta property="article:published_time" :content="isostamp" />
|
|
|
|
<Meta property="article:modified_time" :content="isostamp" />
|
|
|
|
<Meta property="article:author" content="Evert Prants" />
|
2022-12-04 10:12:29 +00:00
|
|
|
<Meta
|
|
|
|
v-for="tag in post?.tags || []"
|
|
|
|
property="article:tag"
|
|
|
|
:content="tag"
|
|
|
|
/>
|
2022-10-16 11:04:03 +00:00
|
|
|
<Meta name="twitter:card" content="summary" />
|
2022-12-04 10:12:29 +00:00
|
|
|
<Title>{{ post?.title }} | Evert's Blog | lunasqu.ee</Title>
|
2022-10-16 11:04:03 +00:00
|
|
|
</Head>
|
|
|
|
|
2022-10-16 09:37:13 +00:00
|
|
|
<BlogPost :post="post" :detail="true" />
|
|
|
|
</NuxtLayout>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2022-10-16 11:04:03 +00:00
|
|
|
import type { BlogPost } from '~~/lib/types/post';
|
|
|
|
|
2022-10-16 09:37:13 +00:00
|
|
|
const route = useRoute();
|
2022-10-16 11:34:04 +00:00
|
|
|
const { data: post } = await useFetch<BlogPost>(
|
|
|
|
`/api/blog/${route.params.slug}`,
|
|
|
|
{
|
|
|
|
key: `${route.params.slug}-post`,
|
|
|
|
}
|
2022-10-16 11:04:03 +00:00
|
|
|
);
|
|
|
|
|
2022-12-04 10:12:29 +00:00
|
|
|
const isostamp = computed(() =>
|
|
|
|
post.value ? new Date(post.value.date).toISOString() : ''
|
|
|
|
);
|
|
|
|
|
2022-10-16 11:04:03 +00:00
|
|
|
const preview = computed(() =>
|
2022-12-04 10:12:29 +00:00
|
|
|
post.value?.summary
|
2022-10-16 11:04:03 +00:00
|
|
|
.replace(/<[^>]*>?/gm, '')
|
|
|
|
.replace('\n', ' ')
|
2022-10-20 18:52:42 +00:00
|
|
|
.substring(0, 240)
|
2022-10-16 11:04:03 +00:00
|
|
|
);
|
2022-10-16 09:37:13 +00:00
|
|
|
</script>
|