]> juplo.de Git - website/commitdiff
Schritt 4: Blog-Routing vollständig und stabil
authorKai Moritz <kai.milan.moritz@googlemail.com>
Sat, 6 Jun 2026 07:42:50 +0000 (07:42 +0000)
committerKai Moritz <kai.milan.moritz@googlemail.com>
Sat, 6 Jun 2026 07:42:50 +0000 (07:42 +0000)
/blog/archive/-Übersichtsseite hinzugefügt.
Routing-Inventur: 65 Seiten werden korrekt generiert:
- 54 Blog-Posts unter Original-Flat-URLs (aus url:-Frontmatter)
- 8 Jahresarchive (/blog/archive/YYYY/)
- /blog/archive/ Übersicht
- /blog/ Index
- / Startseite (Platzhalter)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
src/pages/blog/archive/index.astro [new file with mode: 0644]

diff --git a/src/pages/blog/archive/index.astro b/src/pages/blog/archive/index.astro
new file mode 100644 (file)
index 0000000..5d7880e
--- /dev/null
@@ -0,0 +1,27 @@
+---
+import { getCollection } from 'astro:content';
+
+const posts = await getCollection('blog', ({ data }) => !data.draft);
+const byYear: Record<string, number> = {};
+for (const post of posts) {
+  const year = post.data.date.getFullYear().toString();
+  byYear[year] = (byYear[year] ?? 0) + 1;
+}
+const years = Object.keys(byYear).sort((a, b) => Number(b) - Number(a));
+---
+<html lang="en">
+<head><meta charset="utf-8"><title>Archiv | juplo</title></head>
+<body>
+  <h1>Archiv</h1>
+  <ul>
+    {years.map(year => (
+      <li>
+        <a href={`/blog/archive/${year}/`}>
+          <span>{year}</span> <span>({byYear[year]})</span>
+        </a>
+      </li>
+    ))}
+  </ul>
+  <p><a href="/blog/">← Blog</a></p>
+</body>
+</html>