From 9bf09a8a3ff89c703099eb6084e151c912feb1ac Mon Sep 17 00:00:00 2001 From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com> Date: Wed, 16 Jul 2025 14:02:04 +0800 Subject: [PATCH] refactor(list.html): correct indention --- layouts/_default/list.html | 249 ++++++++++++++++++------------------- 1 file changed, 121 insertions(+), 128 deletions(-) diff --git a/layouts/_default/list.html b/layouts/_default/list.html index db52acd1..465c4f97 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,139 +1,132 @@ {{ define "main" }} - -{{ .Scratch.Set "scope" "list" }} -{{ if .Site.Params.list.showHero | default false }} -{{ $heroStyle := print "hero/" .Site.Params.list.heroStyle ".html" }} -{{ if templates.Exists ( printf "partials/%s" $heroStyle ) }} -{{ partial $heroStyle . }} -{{ else }} -{{ partial "hero/basic.html" . }} -{{ end }} -{{- end -}} - -{{ $toc := and (.Params.showTableOfContents | default (.Site.Params.list.showTableOfContents | default false)) (in -.TableOfContents " - {{ if .Params.showBreadcrumbs | default (.Site.Params.list.showBreadcrumbs | default false) }} - {{ partial "breadcrumbs.html" . }} - {{ end }} -

{{ .Title }}

-
- {{ partial "article-meta/list.html" (dict "context" . "scope" "single") }} -
- {{ $translations := .AllTranslations }} - {{ with .File }} - {{ $path := .Path }} - {{range $translations}} - {{ $lang := print "." .Lang ".md" }} - {{ $path = replace $path $lang ".md" }} - {{end}} - {{ $jsPage := resources.Get "js/page.js" }} - {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }} - - {{ end }} - -
- {{ if $toc }} -
-
- {{ partial "toc.html" . }} -
-
+ {{ .Scratch.Set "scope" "list" }} + {{ if .Site.Params.list.showHero | default false }} + {{ $heroStyle := print "hero/" .Site.Params.list.heroStyle ".html" }} + {{ if templates.Exists ( printf "partials/%s" $heroStyle ) }} + {{ partial $heroStyle . }} + {{ else }} + {{ partial "hero/basic.html" . }} {{ end }} -
- {{ .Content }} + {{- end -}} + + {{ $toc := and (.Params.showTableOfContents | default (.Site.Params.list.showTableOfContents | default false)) (in .TableOfContents " + {{ if .Params.showBreadcrumbs | default (.Site.Params.list.showBreadcrumbs | default false) }} + {{ partial "breadcrumbs.html" . }} + {{ end }} +

{{ .Title }}

+
+ {{ partial "article-meta/list.html" (dict "context" . "scope" "single") }}
- - - - -
- {{ if gt .Pages 0 }} - - {{ $cardView := .Params.cardView | default (.Site.Params.list.cardView | default false) }} - {{ $cardViewScreenWidth := .Params.cardViewScreenWidth | default (.Site.Params.list.cardViewScreenWidth | default false) }} - {{ $groupByYear := .Params.groupByYear | default ($.Site.Params.list.groupByYear | default false) }} - {{ $orderByWeight := .Params.orderByWeight | default ($.Site.Params.list.orderByWeight | default false) }} - {{ $groupByYear := and (not $orderByWeight) $groupByYear }} - - {{ if not $cardView }} - -
- {{ if not $orderByWeight }} - {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} - {{ if $groupByYear }} -

- {{ .Key }} -

- {{ end }} - {{ range .Pages }} - {{ partial "article-link/simple.html" . }} - {{ end }} - {{ end }} - {{ else }} - {{ range (.Paginate (.Pages.ByWeight)).Pages }} - {{ partial "article-link/simple.html" . }} - {{ end }} + {{ $translations := .AllTranslations }} + {{ with .File }} + {{ $path := .Path }} + {{ range $translations }} + {{ $lang := print "." .Lang ".md" }} + {{ $path = replace $path $lang ".md" }} {{ end }} + {{ $jsPage := resources.Get "js/page.js" }} + {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }} + + {{ end }} + +
+ {{ if $toc }} +
+
+ {{ partial "toc.html" . }} +
+
+ {{ end }} +
+ {{ .Content }} +
- {{ else }} + {{ if gt .Pages 0 }} + {{ $cardView := .Params.cardView | default (.Site.Params.list.cardView | default false) }} + {{ $cardViewScreenWidth := .Params.cardViewScreenWidth | default (.Site.Params.list.cardViewScreenWidth | default false) }} + {{ $groupByYear := .Params.groupByYear | default ($.Site.Params.list.groupByYear | default false) }} + {{ $orderByWeight := .Params.orderByWeight | default ($.Site.Params.list.orderByWeight | default false) }} + {{ $groupByYear := and (not $orderByWeight) $groupByYear }} - {{ if $groupByYear }} - - {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} - {{ if $cardViewScreenWidth }} -
- {{ end }} -

- {{ .Key }} -

-
- {{ range .Pages }} - {{ partial "article-link/card.html" . }} + {{ if not $cardView }} +
+ {{ if not $orderByWeight }} + {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} + {{ if $groupByYear }} +

+ {{ .Key }} +

+ {{ end }} + {{ range .Pages }} + {{ partial "article-link/simple.html" . }} + {{ end }} + {{ end }} + {{ else }} + {{ range (.Paginate (.Pages.ByWeight)).Pages }} + {{ partial "article-link/simple.html" . }} + {{ end }} {{ end }}
- {{ if $cardViewScreenWidth }}
{{ end }} + + {{ else }} + + {{ if $groupByYear }} + {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} + {{ if $cardViewScreenWidth }} +
+ {{ end }} +

+ {{ .Key }} +

+
+ {{ range .Pages }} + {{ partial "article-link/card.html" . }} + {{ end }} +
+ {{ if $cardViewScreenWidth }} +
+ {{ end }} + {{ end }} + + {{ else }} + + {{ if $cardViewScreenWidth }} +
+
+ {{ else }} +
+ {{ end }} + {{ if not $orderByWeight }} + {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} + {{ range .Pages }} + {{ partial "article-link/card.html" . }} + {{ end }} + {{ end }} + {{ else }} + {{ range (.Paginate (.Pages.ByWeight)).Pages }} + {{ partial "article-link/card.html" . }} + {{ end }} + {{ end }} +
+ {{ if $cardViewScreenWidth }} +
+ {{ end }} + {{ end }} + {{ end }} - - {{ else }} - - {{ if $cardViewScreenWidth }} -
-
- {{ else }} -
- {{ end }} - {{ if not $orderByWeight }} - {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} - {{ range .Pages }} - {{ partial "article-link/card.html" . }} - {{ end }} - {{ end }} - {{ else }} - {{ range (.Paginate (.Pages.ByWeight)).Pages }} - {{ partial "article-link/card.html" . }} - {{ end }} - {{ end }} -
- {{ if $cardViewScreenWidth }}
{{ end }} - + {{ else }} +
+

+ {{ i18n "list.no_articles" | emojify }} +

+
{{ end }} - - {{end}} - - {{ else }} -
-

- {{ i18n "list.no_articles" | emojify }} -

-
- {{ end }} - - {{ partial "pagination.html" . }} - - {{ end }} + {{ partial "pagination.html" . }} +{{ end }}