update content render

Signed-off-by: nurRiyad <asadnurriyad@gmail.com>
This commit is contained in:
nurRiyad
2023-01-05 22:02:43 +06:00
parent acbbc595b2
commit bb2c026901
5 changed files with 134 additions and 35 deletions

View File

@@ -1,30 +1,13 @@
<script setup lang="ts">
import { ParsedContent } from "@nuxt/content/dist/runtime/types";
definePageMeta({
layout: "blog",
});
const route = useRoute();
const path = computed(() => {
return route.path || "";
});
const data = useState("blogData");
const content = computed(() => {
const allpost = (data.value as Array<ParsedContent>) || [];
return allpost.find((post) => post._path === path.value) || {};
});
</script>
<template>
<main
class="container mx-auto bg-white max-w-6xl p-6 min-h-screen prose prose-slate"
>
<ContentRenderer :value="content">
<ContentRendererMarkdown :value="content" />
</ContentRenderer>
<ContentDoc />
</main>
</template>