diff --git a/src/pages/tags/index.astro b/src/pages/tags/index.astro new file mode 100644 index 0000000..54e75a7 --- /dev/null +++ b/src/pages/tags/index.astro @@ -0,0 +1,32 @@ +--- +import { getCollection } from "astro:content"; +import Layout from "../../layouts/Layout.astro"; + +const posts = await getCollection("blog"); +const tagsMap = new Map(); +posts.forEach((post) => { + post.data.tags?.forEach((tag) => { + tagsMap.set(tag, (tagsMap.get(tag) || 0) + 1); + }); +}); +const tags = Array.from(tagsMap.entries()).sort((a, b) => + a[0].localeCompare(b[0]), +); +--- + + +

Tags

+ +