diff --git a/components/content/ProseCode.vue b/components/content/ProseCode.vue deleted file mode 100644 index ba756b9..0000000 --- a/components/content/ProseCode.vue +++ /dev/null @@ -1,37 +0,0 @@ - - - - - diff --git a/pages/blogs/[blog].vue b/pages/blogs/[blog].vue index bcd0a8e..d2cf679 100644 --- a/pages/blogs/[blog].vue +++ b/pages/blogs/[blog].vue @@ -2,18 +2,22 @@ import type { BlogPost } from '@/types/blog' const { path } = useRoute() -const articles = await queryContent(path).findOne() + +const { data: articles, error } = await useAsyncData(`blog-post-${path}`, () => queryContent(path).findOne()) + +if (error.value) + navigateTo('/404') const data = computed(() => { return { - title: articles.title || 'no-title available', - description: articles.description || 'no-descriptoin available', - image: articles.image || '/nuxt-blog/no-image_cyyits.png', - alt: articles.alt || 'no alter data available', - ogImage: articles.ogImage || '/nuxt-blog/no-image_cyyits.png', - date: articles.date || 'not-date-available', - tags: articles.tags || [], - published: articles.published || false, + title: articles.value?.title || 'no-title available', + description: articles.value?.description || 'no-descriptoin available', + image: articles.value?.image || '/nuxt-blog/no-image_cyyits.png', + alt: articles.value?.alt || 'no alter data available', + ogImage: articles.value?.ogImage || '/nuxt-blog/no-image_cyyits.png', + date: articles.value?.date || 'not-date-available', + tags: articles.value?.tags || [], + published: articles.value?.published || false, } }) @@ -87,7 +91,7 @@ useHead({
- +