refactor(list.html): correct indention

This commit is contained in:
ZhenShuo Leo
2025-07-16 14:02:04 +08:00
parent 2c71bda97f
commit 9bf09a8a3f
+22 -29
View File
@@ -1,17 +1,16 @@
{{ define "main" }} {{ 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 -}}
{{ .Scratch.Set "scope" "list" }} {{ $toc := and (.Params.showTableOfContents | default (.Site.Params.list.showTableOfContents | default false)) (in .TableOfContents "<ul") }}
{{ if .Site.Params.list.showHero | default false }} <header>
{{ $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 "<ul") }} <header>
{{ if .Params.showBreadcrumbs | default (.Site.Params.list.showBreadcrumbs | default false) }} {{ if .Params.showBreadcrumbs | default (.Site.Params.list.showBreadcrumbs | default false) }}
{{ partial "breadcrumbs.html" . }} {{ partial "breadcrumbs.html" . }}
{{ end }} {{ end }}
@@ -22,10 +21,10 @@
{{ $translations := .AllTranslations }} {{ $translations := .AllTranslations }}
{{ with .File }} {{ with .File }}
{{ $path := .Path }} {{ $path := .Path }}
{{range $translations}} {{ range $translations }}
{{ $lang := print "." .Lang ".md" }} {{ $lang := print "." .Lang ".md" }}
{{ $path = replace $path $lang ".md" }} {{ $path = replace $path $lang ".md" }}
{{end}} {{ end }}
{{ $jsPage := resources.Get "js/page.js" }} {{ $jsPage := resources.Get "js/page.js" }}
{{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }} {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }}
<script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}" data-oid="views_{{ $path }}" data-oid-likes="likes_{{ $path }}"></script> <script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}" data-oid="views_{{ $path }}" data-oid-likes="likes_{{ $path }}"></script>
@@ -47,13 +46,9 @@
<div class="min-w-0 min-h-0 max-w-prose"> <div class="min-w-0 min-h-0 max-w-prose">
{{ .Content }} {{ .Content }}
</div> </div>
</section> </section>
{{ if gt .Pages 0 }}
{{ if gt .Pages 0 }}
{{ $cardView := .Params.cardView | default (.Site.Params.list.cardView | default false) }} {{ $cardView := .Params.cardView | default (.Site.Params.list.cardView | default false) }}
{{ $cardViewScreenWidth := .Params.cardViewScreenWidth | default (.Site.Params.list.cardViewScreenWidth | default false) }} {{ $cardViewScreenWidth := .Params.cardViewScreenWidth | default (.Site.Params.list.cardViewScreenWidth | default false) }}
{{ $groupByYear := .Params.groupByYear | default ($.Site.Params.list.groupByYear | default false) }} {{ $groupByYear := .Params.groupByYear | default ($.Site.Params.list.groupByYear | default false) }}
@@ -61,7 +56,6 @@
{{ $groupByYear := and (not $orderByWeight) $groupByYear }} {{ $groupByYear := and (not $orderByWeight) $groupByYear }}
{{ if not $cardView }} {{ if not $cardView }}
<section class="space-y-10 w-full"> <section class="space-y-10 w-full">
{{ if not $orderByWeight }} {{ if not $orderByWeight }}
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
@@ -84,7 +78,6 @@
{{ else }} {{ else }}
{{ if $groupByYear }} {{ if $groupByYear }}
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
{{ if $cardViewScreenWidth }} {{ if $cardViewScreenWidth }}
<div class="relative w-screen max-w-[1600px] px-[30px] left-[calc(max(-50vw,-800px)+50%)]"> <div class="relative w-screen max-w-[1600px] px-[30px] left-[calc(max(-50vw,-800px)+50%)]">
@@ -97,7 +90,9 @@
{{ partial "article-link/card.html" . }} {{ partial "article-link/card.html" . }}
{{ end }} {{ end }}
</section> </section>
{{ if $cardViewScreenWidth }} </div> {{ end }} {{ if $cardViewScreenWidth }}
</div>
{{ end }}
{{ end }} {{ end }}
{{ else }} {{ else }}
@@ -120,12 +115,12 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
</section> </section>
{{ if $cardViewScreenWidth }} </div> {{ end }} {{ if $cardViewScreenWidth }}
</div>
{{ end }}
{{ end }} {{ end }}
{{end}} {{ end }}
{{ else }} {{ else }}
<section class="mt-10 prose dark:prose-invert"> <section class="mt-10 prose dark:prose-invert">
<p class="py-8 border-t"> <p class="py-8 border-t">
@@ -133,7 +128,5 @@
</p> </p>
</section> </section>
{{ end }} {{ end }}
{{ partial "pagination.html" . }} {{ partial "pagination.html" . }}
{{ end }}
{{ end }}