<template>
  <NuxtLayout name="blog">
    <Head>
      <Title>Tag: {{ route.params.tag }} | Evert's Blog | lunasqu.ee</Title>
    </Head>
    <BlogArchive :posts="posts" />
  </NuxtLayout>
</template>

<script setup lang="ts">
import type { BlogPost } from '~~/lib/types/post';

const route = useRoute();
const { data: posts } = await useFetch<BlogPost[]>(`/api/blog`, {
  key: `${route.params.tag}-tag-page`,
  params: {
    tag: route.params.tag,
    render: false,
  },
});
</script>
