---
import {getCollection} from "astro:content";
import Layout from "../layouts/Layout.astro";
const allPosts = await getCollection('posts');
const uniqueTags = [...new Set(allPosts.map((post: any) => post.data.tags ? post.data.tags : []).flat())];
---
<Layout title="Tags" description="List all tags used in the blog posts.">
    <h1 class="title">~/blog/tags</h1>
    <div style="margin-top: 2rem;">
        <span class="command">ls -l tags/</span>
        <div style="margin-top: 1rem; margin-left: 1rem;">
            {uniqueTags.map((tag) => (
                    <p><a href={`/tags/${tag}`}>{tag}</a></p>
            ))}
        </div>
    </div>
</Layout>
