+ {{ 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 }}
+
+
+
+ {{ 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 }}
From b0c3ac1321bc063eb50525514d4710920fc737b7 Mon Sep 17 00:00:00 2001
From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com>
Date: Wed, 16 Jul 2025 14:48:18 +0800
Subject: [PATCH 2/8] refactor(list.html): make list.html formattable
---
.prettierignore | 1 -
layouts/_default/list.html | 67 ++++++++++++++++++++++++--------------
2 files changed, 42 insertions(+), 26 deletions(-)
diff --git a/.prettierignore b/.prettierignore
index 0a829920..d26f8b34 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -27,7 +27,6 @@ static
layouts/_default/_markup/render-heading.html
layouts/_default/index.json
-layouts/_default/list.html
layouts/shortcodes/screenshot.html
layouts/shortcodes/figure.html
layouts/partials/hugo-embedded/shortcodes/figure-default.html
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 465c4f97..18d60f54 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -81,17 +81,24 @@
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
{{ if $cardViewScreenWidth }}
- {{ end }}
-
- {{ .Key }}
-
-
- {{ range .Pages }}
- {{ partial "article-link/card.html" . }}
- {{ end }}
-
- {{ if $cardViewScreenWidth }}
+
+ {{ .Key }}
+
+
+ {{ range .Pages }}
+ {{ partial "article-link/card.html" . }}
+ {{ end }}
+
+ {{ else }}
+
+ {{ .Key }}
+
+
+ {{ range .Pages }}
+ {{ partial "article-link/card.html" . }}
+ {{ end }}
+
{{ end }}
{{ end }}
@@ -99,24 +106,34 @@
{{ if $cardViewScreenWidth }}
-
+
+ {{ 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 }}
+
+
{{ else }}
- {{ end }}
- {{ if not $orderByWeight }}
- {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
- {{ range .Pages }}
- {{ partial "article-link/card.html" . }}
+ {{ 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 }}
- {{ end }}
- {{ else }}
- {{ range (.Paginate (.Pages.ByWeight)).Pages }}
- {{ partial "article-link/card.html" . }}
- {{ end }}
- {{ end }}
-
- {{ if $cardViewScreenWidth }}
-