diff options
| author | eltrac <hi@eltr.ac> | 2026-03-08 10:59:50 +0800 |
|---|---|---|
| committer | eltrac <hi@eltr.ac> | 2026-03-08 10:59:50 +0800 |
| commit | 1a5242df3e9e91ef69b497634080d9f9e13f64ec (patch) | |
| tree | ff65575a34b755fd884d3e9444fb5eb2aafe8541 | |
| parent | c2d010d29aa4ff651ff1234af699bc9a1cd4debf (diff) | |
docs: new archive page
group by year and add pagefind search bar
| -rw-r--r-- | content/archive.md | 2 | ||||
| -rw-r--r-- | i18n/zh.toml | 1 | ||||
| -rw-r--r-- | layouts/archive.html | 14 |
3 files changed, 11 insertions, 6 deletions
diff --git a/content/archive.md b/content/archive.md index 3cb9a942..c7135aa8 100644 --- a/content/archive.md +++ b/content/archive.md @@ -1,4 +1,4 @@ +++ -title = '归档' +title = '档案馆' layout = 'archive' +++ diff --git a/i18n/zh.toml b/i18n/zh.toml index 04fdbea5..018d9d66 100644 --- a/i18n/zh.toml +++ b/i18n/zh.toml @@ -18,6 +18,7 @@ dark = "暗色" [archivePage] postCountMonthly = "{{ . }} 篇文章" postCountAnnual = "共计 {{ . }} 篇文章" +pageCount = "共 {{ . }} 个页面" [postPage] commentNotLoaded = "如果评论未加载,请尝试刷新页面" diff --git a/layouts/archive.html b/layouts/archive.html index 764f0879..87bafab2 100644 --- a/layouts/archive.html +++ b/layouts/archive.html @@ -1,11 +1,15 @@ {{ define "main" }} <article> {{ partial "header" . }} - {{ partial "home/home-nav" . }} + {{ partial "taxonomy/pagefind" . }} <div class="post-content text-size-lg"> - <ol class="mx-0 my-4 p-0 leading-loose flex flex-col-reverse"> - {{ range (.Site.RegularPages | collections.Reverse) }} - {{ if eq .Language .Site.Language }} + {{ range .Site.RegularPages.GroupByDate "2006" }} + {{ partial "components/section-title" (dict + "Left" .Key + "Right" (T "archivePage.pageCount" (len .Pages)) + )}} + <ol class="mx-0 my-4 p-0 leading-loose flex flex-col"> + {{ range .Pages }} <li class="list-decimal text-secondary lazy-render"> <div class="flex justify-between"> <a href="{{ .Permalink }}">{{ .LinkTitle }}</a> @@ -13,8 +17,8 @@ </div> </li> {{ end }} - {{ end }} </ol> + {{ end }} </div> </article> {{ partial "footer.html" . }} |
