diff options
| author | eltrac <hi@eltr.ac> | 2026-03-08 14:41:19 +0800 |
|---|---|---|
| committer | eltrac <hi@eltr.ac> | 2026-03-08 14:41:19 +0800 |
| commit | fe0bafba4a126fef9c169bfefa09201a6ea400ca (patch) | |
| tree | 66b77deef5773a56f5f962ed3b65d8ac1330203c /layouts | |
| parent | 5ccd892f23ba9cfa7145fec7137a49eb2077a447 (diff) | |
| parent | c09ffa2e5b0db615f4a4614da7d4811616afdf4f (diff) | |
merge branch restructure
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/_partials/posts/action-menu.html | 11 | ||||
| -rw-r--r-- | layouts/_partials/section-categories.html | 20 | ||||
| -rw-r--r-- | layouts/_partials/taxonomy/all-categories.html | 14 | ||||
| -rw-r--r-- | layouts/_partials/taxonomy/archived-categories.html | 16 | ||||
| -rw-r--r-- | layouts/archive.html | 16 | ||||
| -rw-r--r-- | layouts/article/page.html (renamed from layouts/essays/page.html) | 0 | ||||
| -rw-r--r-- | layouts/article/section.html (renamed from layouts/essays/section.html) | 10 | ||||
| -rw-r--r-- | layouts/highlights.html | 4 | ||||
| -rw-r--r-- | layouts/taxonomy.html | 4 | ||||
| -rw-r--r-- | layouts/weekly/page.html (renamed from layouts/posts/page.html) | 0 | ||||
| -rw-r--r-- | layouts/weekly/section.html (renamed from layouts/section.html) | 18 |
11 files changed, 58 insertions, 55 deletions
diff --git a/layouts/_partials/posts/action-menu.html b/layouts/_partials/posts/action-menu.html index 215dc96a..d3544c1f 100644 --- a/layouts/_partials/posts/action-menu.html +++ b/layouts/_partials/posts/action-menu.html @@ -1,4 +1,13 @@ {{ $webmentions := index .Site.Data.webmentions .RelPermalink }} + +<!-- + some pages were moved, merge their webmention with old Data +--> +{{ $other_webmentions := index .Site.Data.webmentions (printf "/posts%s" .RelPermalink ) }} +{{ if $other_webmentions }} + {{ $webmentions = $webmentions | union $other_webmentions }} +{{ end }} + {{ $likes := slice }} {{ $replies := slice }} {{ $mentions := slice }} @@ -16,7 +25,7 @@ {{ partial "posts/action-area" . }} <details class="my-4 mb-5 no-mark"> - <summary class="cursor-pointer"> + <summary class="cursor-pointer flex"> {{ partial "posts/webmention-summary" (dict "likes" $likes "page" . diff --git a/layouts/_partials/section-categories.html b/layouts/_partials/section-categories.html deleted file mode 100644 index 40e6600e..00000000 --- a/layouts/_partials/section-categories.html +++ /dev/null @@ -1,20 +0,0 @@ -{{ $categories := slice }} -{{ range . }} - {{ with .Params.categories }} - {{ if not (in $categories .) }} - {{ $categories = $categories | append . }} - {{ end }} - {{ end }} -{{ end }} - -<div class="flex gap-2 flex-wrap"> - {{ range $categories }} - <a href="/categories/{{ . | urlize }}/" - class="text-size-lg px-3 py-2 - transition-colors duration-300 rounded-xl hover:no-underline - bg-slate-2/50 dark:bg-neutral-800/50 - hover:bg-[var(--text-color)] hover:text-[var(--block-background-color)]"> - {{ . }} - </a> - {{ end }} -</div> diff --git a/layouts/_partials/taxonomy/all-categories.html b/layouts/_partials/taxonomy/all-categories.html index 85a228fe..7cb5813a 100644 --- a/layouts/_partials/taxonomy/all-categories.html +++ b/layouts/_partials/taxonomy/all-categories.html @@ -1,29 +1,31 @@ +<p class="text-sm text-secondary">* 表示常驻系列,其他系列可能会在完成后停止更新<p> <!-- Display Categories --> <div class="md:relative outbox md:h-[20rem] md:w-full"> <section class="md:overflow-x-auto md:absolute md:left-0 md:right-0"> <div class="flex flex-wrap justify-between md:flex-nowrap md:gap-6"> <hr /> - {{ range sort .Site.Taxonomies.categories ".Count" "desc" }} + {{ range sort (sort .Site.Taxonomies.categories ".Count" "desc") ".Page.Params.pinned" "desc" }} + {{ if not .Page.Params.archive }} <a href="{{ .Page.RelPermalink }}" class="block hover:no-underline hover:-transform-translate-y-2 transition-transform md:writing-vertical" style="view-transition-name: category-{{ .Page.Title }};"> <div> - <h3 class="mx-2"> - {{ with .Page.Params.icon }} - <span class="inline-block">{{ . }}</span> - {{ end }} - <span class="xerox">《{{ .Page.LinkTitle }}》</span> + <h3 class="mx-2 xerox"> + 《{{ .Page.LinkTitle }}》 + {{ if .Page.Params.pinned }}*{{ end }} </h3> <p class="m-0 text-secondary mt-4">{{ .Page.Params.description | markdownify }}</p> </div> </a> <hr /> + {{ end }} {{ end }} </div> </section> </div> + <p class="mt-4"> <a class="small-button" href="/categories/uncategorized/"> 查看随笔 <span class="text-secondary">→</span> diff --git a/layouts/_partials/taxonomy/archived-categories.html b/layouts/_partials/taxonomy/archived-categories.html new file mode 100644 index 00000000..26ed68d8 --- /dev/null +++ b/layouts/_partials/taxonomy/archived-categories.html @@ -0,0 +1,16 @@ +<ul class="list-none p-0"> + {{ range .Site.Taxonomies.categories }} + {{ if .Page.Params.archive }} + <li class="flex justify-between items-center gap-4"> + <a class="flex-shrink-0" href="{{ .Page.RelPermalink }}"> + <h3 class="xerox">《{{ .Page.LinkTitle }}》</h3> + </a> + <div class="w-full"><hr class="m-0" /></div> + <span class="text-secondary font-mono flex-shrink-0"> + {{ T "archivePage.postCountMonthly" (len .Pages) }} + </span> + </li> + {{ end }} + {{ end }} +</ul> + diff --git a/layouts/archive.html b/layouts/archive.html index 3af7c9ce..87bafab2 100644 --- a/layouts/archive.html +++ b/layouts/archive.html @@ -1,20 +1,24 @@ {{ 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 }} - <li class="list-decimal text-secondary"> + {{ 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> <a href="/{{ .Section }}" class="font-mono text-secondary">{{ .Section }}</a> </div> </li> {{ end }} - {{ end }} </ol> + {{ end }} </div> </article> {{ partial "footer.html" . }} diff --git a/layouts/essays/page.html b/layouts/article/page.html index e093e810..e093e810 100644 --- a/layouts/essays/page.html +++ b/layouts/article/page.html diff --git a/layouts/essays/section.html b/layouts/article/section.html index f5a08ace..b56b30eb 100644 --- a/layouts/essays/section.html +++ b/layouts/article/section.html @@ -1,12 +1,14 @@ {{ define "main" }} + + {{ $pages := .Pages }} + {{ $categories := slice }} + <article> {{ partial "header.html" . }} {{ partial "home/home-nav" . }} <div class="posts-list pagefind-exclude"> <div class="markdown-body">{{ .Content }}</div> - {{ $pages := .Pages }} - {{ partial "section-categories" $pages }} - <!-- Post Archive List --> + {{ $remainingMonthsToOpen := 3 }} {{ range $pages.GroupByDate "2006" -}} <section class="w-full"> @@ -16,7 +18,7 @@ )}} {{ range .Pages.GroupByDate "January" }} - <details class="posts-month-archive"{{ if gt $remainingMonthsToOpen 0 }} open{{ end }}> + <details class="lazy-render"{{ if gt $remainingMonthsToOpen 0 }} open{{ end }}> <summary class="flex items-center border-b border-b-dashed border-[var(--border-color)] py-2 px-1"> <h2 class="text-size-lg inline-block w-full m-0 flex justify-between items-center"> diff --git a/layouts/highlights.html b/layouts/highlights.html index 9d7c13bf..f9f9c030 100644 --- a/layouts/highlights.html +++ b/layouts/highlights.html @@ -6,12 +6,12 @@ </div> <!-- Highlights --> {{ range shuffle site.Data.highlights }} - <section class="post-content"> + <section class="post-content lazy-render"> <h3><a href="{{ .url }}">《{{ .title }}》</a></h3> <ul class="list-none"> {{ range .highlights }} <li class="my-4 text-lg"> - <a class="font-italic hover:no-underline" href="{{ .link }}">{{ .text | markdownify }}</a> + <a class="hover:no-underline" href="{{ .link }}">{{ .text | markdownify }}</a> </li> {{ end }} </ul> diff --git a/layouts/taxonomy.html b/layouts/taxonomy.html index 1a00ef86..600d4d03 100644 --- a/layouts/taxonomy.html +++ b/layouts/taxonomy.html @@ -6,6 +6,10 @@ </div> <h2>文章系列</h2> {{ partial "taxonomy/all-categories.html" . }} + <hr /> + <h2>尘封的系列</h2> + <p>这些文章系列已经不再更新。</p> + {{ partial "taxonomy/archived-categories.html" . }} </article> {{ partial "footer.html" . }} {{ end }} diff --git a/layouts/posts/page.html b/layouts/weekly/page.html index e093e810..e093e810 100644 --- a/layouts/posts/page.html +++ b/layouts/weekly/page.html diff --git a/layouts/section.html b/layouts/weekly/section.html index a70c6cd1..14bb4db4 100644 --- a/layouts/section.html +++ b/layouts/weekly/section.html @@ -9,12 +9,6 @@ <div class="posts-list pagefind-exclude"> <div class="markdown-body">{{ .Content }}</div> - {{ partial "section-categories" $pages }} - - {{ if eq .Site.Language.Lang "zh" }} - <p class="text-secondary text-sm">*稻草人周刊也属于散文集,但为了方便查阅,周刊没有列在下面,请到<a href="/categories/稻草人周刊/">分类页面</a>查看周刊。</p> - {{ end }} - <!-- Post Archive List --> {{ $remainingMonthsToOpen := 3 }} {{ range $pages.GroupByDate "2006" -}} @@ -25,28 +19,20 @@ )}} {{ range .Pages.GroupByDate "January" }} - <div class="posts-month-archive"{{ if gt $remainingMonthsToOpen 0 }} open{{ end }}> + <div class="lazy-render"{{ if gt $remainingMonthsToOpen 0 }} open{{ end }}> <h2 class="text-size-lg inline-block w-full m-0 flex justify-between items-center"> {{ .Key }} </h2> <ul class="ps-0 flex flex-col gap-2 list-none leading-relaxed"> {{ range .Pages }} - {{ $isWeekly := (eq .Params.categories "稻草人周刊") }} - {{ if not (eq .Params.categories "稻草人周刊") }} - <li class="flex gap-4 text-size-lg"> - <span class="text-size-xs h-5 font-mono text-secondary flex-shrink-0 - inline-block border-1 border-solid border-t-5 px-1 - border-neutral-200 dark:border-neutral-700"> - {{ .Date.Format "02" }} - </span> + <li class="text-size-lg"> <a href="{{ .RelPermalink }}"> {{ .Title }}{{ with .Params.subtitle }}:<span class="text-secondary">{{. }}</span> {{ end }} </a> </li> {{ end }} - {{ end }} </ul> </div> {{ $remainingMonthsToOpen = sub $remainingMonthsToOpen 1 }} |
