---
import BaseLayout from "../../layouts/BaseLayout.astro";

const pageTitle = "Tag Index";
const allPosts = await Astro.glob("../articles/*.mdx");
const tags = [...new Set(allPosts.map((post) => post.frontmatter.tags).flat())];
---

<BaseLayout pageTitle={pageTitle}>
	<h2>All the categories</h2>
	<ul>
		{
			tags.map((tag) => (
				<li>
					<a href={`/tags/${tag}`}>{tag}</a>
				</li>
			))
		}
	</ul>
</BaseLayout>
