From ed5fe0848d18665cd3fbd6011876207b2fee61e4 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Fri, 6 Jun 2025 14:53:45 +0800 Subject: refactor: reuse some page components --- layouts/posts/single.html | 73 ++++++----------------------------------------- 1 file changed, 8 insertions(+), 65 deletions(-) (limited to 'layouts/posts') diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 71716a82..86d595d6 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -16,38 +16,9 @@
- {{ if .Date }} - {{ $hour := .Date.Hour }} - {{ $fuzzyTimes := slice - (dict "limit" 5 "label" "凌晨") - (dict "limit" 7 "label" "清晨") - (dict "limit" 11 "label" "早上") - (dict "limit" 13 "label" "中午") - (dict "limit" 17 "label" "下午") - (dict "limit" 19 "label" "傍晚") - (dict "limit" 22 "label" "晚上") - }} - {{ $fuzzyTime := "深夜" }} {{/* default */}} - {{ range $fuzzyTimes }} - {{ if lt $hour .limit }} - {{ $fuzzyTime = .label }} - {{ break }} - {{ end }} - {{ end }} - - - {{ end }} - {{ if or .Params.categories .Params.tags }} - · - {{ end }} - {{ if .Params.categories }} - - {{ end }} + {{ partial "components/date" . }} + {{ if or .Params.categories .Params.tags }}·{{ end }} + {{ partial "components/category-pill" . }} {{ range .Params.tags }} {{ end }} @@ -58,46 +29,18 @@
- {{ if .Params.toc }} {{ partial "components/toc" . }} - {{ end }} -
{{ .Content }}
- - {{ if .Params.endnotes }} -
-
-
    - {{ range .Params.endnotes }} -
  • {{ . | markdownify }}
  • - {{ end }} -
+
+ {{ .Content }}
- {{ end }} + + {{ partial "components/endnotes" . }}
{{ partial "components/comment.html" . }} - - {{ with site.RegularPages.Related . | first 1 }} -
-

{{ T "nowReadThis" }}

- {{ range . }} - -
-

{{ .Summary | plainify }}

-
- {{ end }} -
- {{ end }} + {{ partial "components/now-read-this.html" . }} {{ end }} -- cgit v1.2.3