diff --git a/src/components/BaseHeader.astro b/src/components/BaseHeader.astro
index d94ab06..e3ddada 100644
--- a/src/components/BaseHeader.astro
+++ b/src/components/BaseHeader.astro
@@ -12,7 +12,7 @@ import ThemeIcon from './ThemeIcon.astro'
@@ -68,6 +68,7 @@ import ThemeIcon from './ThemeIcon.astro'
gap: 20px;
height: 100%;
align-items: center;
+ margin-right: 12px;
}
.menu-item {
diff --git a/src/pages/archive.astro b/src/pages/archive.astro
new file mode 100644
index 0000000..da91457
--- /dev/null
+++ b/src/pages/archive.astro
@@ -0,0 +1,193 @@
+---
+import Layout from "@/layouts/Layout.astro";
+import type {Archive} from "@/types/archive";
+import {createHttp} from "@/lib/request";
+
+const http = createHttp(Astro.request.headers);
+
+const {data} = await http.get
>("post/archive");
+---
+
+
+
+
+ {
+ data.map((year) => (
+
+
+ {year.year}
+ 共 {year.total} 篇
+
+
+ {year.list.map((month) => (
+
+
{month.month} 月
+
+ {month.list.map((post) => (
+ -
+
+ {post.published_at_display}
+
+ {post.title}
+ {post.category_name}
+
+ ))}
+
+
+ ))}
+
+
+ ))
+ }
+
+
+
+
+
diff --git a/src/types/archive.ts b/src/types/archive.ts
new file mode 100644
index 0000000..298c345
--- /dev/null
+++ b/src/types/archive.ts
@@ -0,0 +1,22 @@
+type ArchiveYear = {
+ year: number;
+ total: number;
+ list: ArchiveMonth[];
+};
+
+type ArchivePost = {
+ id: number;
+ slug: string;
+ title: string;
+ published_at: string;
+ published_at_display: string;
+ category_name: string;
+};
+
+type ArchiveMonth = {
+ month: number;
+ display_month: string;
+ list: ArchivePost[];
+};
+
+export type Archive = ArchiveYear[];