feat: add filter to main page
This commit is contained in:
parent
49b772918b
commit
631416984c
@ -9,6 +9,14 @@ const docs = await queryContent<BlogParsedContent>("/blog")
|
|||||||
.sort({ date: -1 })
|
.sort({ date: -1 })
|
||||||
.where({ _draft: false })
|
.where({ _draft: false })
|
||||||
.find();
|
.find();
|
||||||
|
|
||||||
|
const tags = new Set(
|
||||||
|
docs
|
||||||
|
.map((p) => p.tags)
|
||||||
|
.flat()
|
||||||
|
.filter((p) => !p.includes(" "))
|
||||||
|
.sort()
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -16,6 +24,16 @@ const docs = await queryContent<BlogParsedContent>("/blog")
|
|||||||
class="flex flex-col grow prose dark:prose-invert max-w-3xl gap-6 transition"
|
class="flex flex-col grow prose dark:prose-invert max-w-3xl gap-6 transition"
|
||||||
>
|
>
|
||||||
<h1 class="mb-0">Blog</h1>
|
<h1 class="mb-0">Blog</h1>
|
||||||
|
<div class="m-0">
|
||||||
|
Filter:
|
||||||
|
<Tag
|
||||||
|
:dest="`/tags/blog/${tag}`"
|
||||||
|
v-for="(tag, index) in tags"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
{{ tag }}
|
||||||
|
</Tag>
|
||||||
|
</div>
|
||||||
<PostPreviewCard
|
<PostPreviewCard
|
||||||
v-for="(post, index) in docs"
|
v-for="(post, index) in docs"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
@ -9,6 +9,14 @@ const docs = await queryContent<StoryParsedContent>("/stories")
|
|||||||
.sort({ date: -1 })
|
.sort({ date: -1 })
|
||||||
.where({ _draft: false })
|
.where({ _draft: false })
|
||||||
.find();
|
.find();
|
||||||
|
|
||||||
|
const tags = new Set(
|
||||||
|
docs
|
||||||
|
.map((p) => p.tags)
|
||||||
|
.flat()
|
||||||
|
.filter((p) => !p.includes(" ")) // do not include AO3-style tags
|
||||||
|
.sort()
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -16,6 +24,16 @@ const docs = await queryContent<StoryParsedContent>("/stories")
|
|||||||
class="flex flex-col grow prose dark:prose-invert max-w-3xl gap-6 transition"
|
class="flex flex-col grow prose dark:prose-invert max-w-3xl gap-6 transition"
|
||||||
>
|
>
|
||||||
<h1 class="mb-0">Stories</h1>
|
<h1 class="mb-0">Stories</h1>
|
||||||
|
<div class="m-0">
|
||||||
|
Filter:
|
||||||
|
<Tag
|
||||||
|
:dest="`/tags/stories/${tag}`"
|
||||||
|
v-for="(tag, index) in tags"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
{{ tag }}
|
||||||
|
</Tag>
|
||||||
|
</div>
|
||||||
<PostPreviewCard
|
<PostPreviewCard
|
||||||
v-for="(story, index) in docs"
|
v-for="(story, index) in docs"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
Loading…
Reference in New Issue
Block a user