---
import { getCollection } from "astro:content";
import Header from "@components/Header.astro";
import Footer from "@components/Footer.astro";
import Layout from "@layouts/Layout.astro";
import Main from "@layouts/Main.astro";
import Tag from "@components/Tag.astro";
import getUniqueTags from "@utils/getUniqueTags";
import { SITE } from "@config";

const posts = await getCollection("blog");

let tags = getUniqueTags(posts);
---

<Layout title={`Tags | ${SITE.title}`}>
  <Header activeNav="tags" />
  <Main pageTitle="Tags" pageDesc="All the tags used in posts.">
    <ul>
      {tags.map(({ tag }) => <Tag {tag} />)}
    </ul>
  </Main>
  <Footer />
</Layout>
