diff --git a/pages/[...slug].vue b/pages/[...slug].vue index c72210f..2a2ad52 100644 --- a/pages/[...slug].vue +++ b/pages/[...slug].vue @@ -11,12 +11,11 @@ const path = computed(() => { return route.path || ""; }); -const { data } = await useAsyncData("page-data", () => - queryContent(`${path.value}`).findOne() -); +const data = useState("blogData"); const content = computed(() => { - return data.value as ParsedContent; + const allpost = (data.value as Array) || []; + return allpost.find((post) => post._path === path.value) || {}; }); diff --git a/pages/index.vue b/pages/index.vue index eafc9fa..452d7ef 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -12,8 +12,7 @@ const getTopCategory = computed(() => { dir: post._dir, }; }); - const uniqType = new Set(alltypes); - return uniqType; + return [...new Map(alltypes.map((item) => [item["dir"], item])).values()]; }); // get all post in recent time order