public/pages/blog.vue

45 lines
909 B
Vue
Raw Normal View History

2022-07-22 17:16:27 -04:00
<script setup lang="ts">
2022-08-10 16:31:25 -04:00
import type { BlogParsedContent } from "@/shared/types";
2022-08-10 20:31:16 -04:00
useTitle("Blog", "Ramblings and ideas");
2022-08-12 21:07:01 -04:00
definePageMeta({ layout: "withtop" });
2022-08-10 16:31:25 -04:00
// TODO: paginate stories
const docs = await queryContent<BlogParsedContent>("/blog")
.sort({ date: -1 })
.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(" "))
.sort()
);
2022-07-22 17:16:27 -04:00
</script>
2022-08-10 16:31:25 -04:00
<template>
<main
class="flex flex-col grow prose dark:prose-invert max-w-3xl gap-6 transition"
>
<h1 class="mb-0">Blog</h1>
2022-10-31 14:18:14 -04:00
<div class="m-0">
Filter:
<Tag
:dest="`/tags/blog/${tag}`"
v-for="(tag, index) in tags"
:key="index"
>
{{ tag }}
</Tag>
</div>
2022-08-10 16:31:25 -04:00
<PostPreviewCard
v-for="(post, index) in docs"
:key="index"
:post="post"
type="blog"
/>
</main>
</template>