---
import { getCollection } from "astro:content";

import BaseLayout from "../../layouts/BaseLayout.astro";
import Partition from "../../components/Partition.astro";
const allPosts = await getCollection("blog");
const tags = [
    ...new Set(allPosts.map((post: any) => post.data.tags).flat()),
];
const pageTitle = "Tag Index";
---

<BaseLayout pageTitle={pageTitle}>
    <Partition>
        <h1 class="text-xl">Blog tags:</h1>
    <div class="tags">
        <main>
        {
            tags.map((tag) => (
                <a href={`/tags/${tag}`}>
                    <p class="tag">- {tag}</p>
                </a>
            ))
        }
        </main>
    </div>
</Partition>
</BaseLayout>
