public/pages/stories.vue

45 lines
962 B
Vue
Raw Normal View History

2022-07-22 17:16:27 -04:00
<script setup lang="ts">
2022-08-10 12:00:48 -04:00
import type { StoryParsedContent } from "@/shared/types";
2022-08-10 20:31:16 -04:00
useTitle("Stories", "Fantasies and worlds");
2022-08-12 21:07:01 -04:00
definePageMeta({ layout: "withtop" });
2022-08-10 12:00:48 -04:00
2022-08-10 13:14:48 -04:00
// TODO: paginate stories
2022-08-10 12:00:48 -04:00
const docs = await queryContent<StoryParsedContent>("/stories")
2022-08-10 16:31:25 -04:00
.sort({ date: -1 })
2022-08-10 12:00:48 -04:00
.where({ _draft: false })
.find();
2022-10-31 14:18:14 -04:00
const tags = new Set(
docs
.map((p) => p.tags)
.flat()
.filter((p) => !p.includes(" ")) // do not include AO3-style tags
.sort()
);
2022-07-22 17:16:27 -04:00
</script>
2022-08-10 11:05:20 -04:00
<template>
2022-08-10 13:27:37 -04:00
<main
class="flex flex-col grow prose dark:prose-invert max-w-3xl gap-6 transition"
>
<h1 class="mb-0">Stories</h1>
2022-10-31 14:18:14 -04:00
<div class="m-0">
Filter:
<Tag
:dest="`/tags/stories/${tag}`"
v-for="(tag, index) in tags"
:key="index"
>
{{ tag }}
</Tag>
</div>
2022-08-10 16:31:25 -04:00
<PostPreviewCard
2022-08-10 13:27:37 -04:00
v-for="(story, index) in docs"
:key="index"
2022-08-10 16:31:25 -04:00
:post="story"
type="stories"
/>
2022-08-10 12:00:48 -04:00
</main>
2022-08-10 11:05:20 -04:00
</template>