diff options
| author | BigCoke233 <hi@guhub.cn> | 2026-01-29 23:32:26 +0800 |
|---|---|---|
| committer | BigCoke233 <hi@guhub.cn> | 2026-01-29 23:32:26 +0800 |
| commit | be72aa817f4c29e3b3c0916d2235fae6ce44e5f5 (patch) | |
| tree | 25babec123af1d0983d6a6e9ef221278d4739690 | |
| parent | 69f620ad0eedb189132aa5e6b480b2d889b6ce88 (diff) | |
feat: add archive page to list all pages
| -rw-r--r-- | content/archive.md | 4 | ||||
| -rw-r--r-- | i18n/en.yml | 1 | ||||
| -rw-r--r-- | i18n/zh.yml | 1 | ||||
| -rw-r--r-- | layouts/_partials/home/latest-posts.html | 4 | ||||
| -rw-r--r-- | layouts/archive.html | 21 |
5 files changed, 31 insertions, 0 deletions
diff --git a/content/archive.md b/content/archive.md new file mode 100644 index 00000000..3cb9a942 --- /dev/null +++ b/content/archive.md @@ -0,0 +1,4 @@ ++++ +title = '归档' +layout = 'archive' ++++ diff --git a/i18n/en.yml b/i18n/en.yml index f7bc5db4..8bb3bfc6 100644 --- a/i18n/en.yml +++ b/i18n/en.yml @@ -1,4 +1,5 @@ lang: en +seeArchive: See all pages archivePage: postCountMonthly: '{{ . }} POSTS' postCountAnnual: '{{ . }} TOTAL POSTS' diff --git a/i18n/zh.yml b/i18n/zh.yml index d0d69c40..a4e45517 100644 --- a/i18n/zh.yml +++ b/i18n/zh.yml @@ -1,4 +1,5 @@ lang: zh-CN +seeArchive: 查看全部页面 archivePage: postCountMonthly: '{{ . }} 篇文章' postCountAnnual: '共计 {{ . }} 篇文章' diff --git a/layouts/_partials/home/latest-posts.html b/layouts/_partials/home/latest-posts.html index ac015111..72e3828a 100644 --- a/layouts/_partials/home/latest-posts.html +++ b/layouts/_partials/home/latest-posts.html @@ -8,4 +8,8 @@ ) }} {{ $firstPost = false }} {{ end }} + <div> + <a class="small-button" href="{{ if eq .Site.Language "zh" }}/archive{{ else }}{{ .Site.LanguagePrefix }}/posts{{ end }}"> + {{ T "seeArchive" }} →</a> + </div> </section> diff --git a/layouts/archive.html b/layouts/archive.html new file mode 100644 index 00000000..3af7c9ce --- /dev/null +++ b/layouts/archive.html @@ -0,0 +1,21 @@ +{{ define "main" }} +<article> + {{ partial "header" . }} + {{ partial "home/home-nav" . }} + <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 }} + <li class="list-decimal text-secondary"> + <div class="flex justify-between"> + <a href="{{ .Permalink }}">{{ .LinkTitle }}</a> + <a href="/{{ .Section }}" class="font-mono text-secondary">{{ .Section }}</a> + </div> + </li> + {{ end }} + {{ end }} + </ol> + </div> +</article> +{{ partial "footer.html" . }} +{{ end }} |
