From c8265de81335a10ac15dded9e2229083d36e6b10 Mon Sep 17 00:00:00 2001 From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com> Date: Wed, 16 Jul 2025 14:51:34 +0800 Subject: [PATCH] refactor(list.html): use intermediate variable for complex condition --- layouts/_default/list.html | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/layouts/_default/list.html b/layouts/_default/list.html index a6df0714..117c8045 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -9,7 +9,8 @@ {{ 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" . }} @@ -35,20 +36,12 @@ data-oid-likes="likes_{{ $path }}"> {{ end }} -
+ {{ $tocMargin := cond $toc "mt-12" "mt-0" -}} + {{ $topClass := cond (hasPrefix .Site.Params.header.layout "fixed") "lg:top-[140px]" "lg:top-10" }} +
{{ if $toc }}
-
+
{{ partial "toc.html" . }}
@@ -94,9 +87,7 @@ {{ .Key }}
+ class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5"> {{ range .Pages }} {{ partial "article-link/card.html" . }} {{ end }} @@ -107,9 +98,7 @@ {{ .Key }}
+ class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3"> {{ range .Pages }} {{ partial "article-link/card.html" . }} {{ end }}