refactor(list.html): make list.html formattable

This commit is contained in:
ZhenShuo Leo
2025-07-16 14:48:18 +08:00
parent 9bf09a8a3f
commit b0c3ac1321
2 changed files with 42 additions and 26 deletions

View File

@@ -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

View File

@@ -81,7 +81,6 @@
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
{{ if $cardViewScreenWidth }}
<div class="relative w-screen max-w-[1600px] px-[30px] left-[calc(max(-50vw,-800px)+50%)]">
{{ end }}
<h2 class="mt-12 mb-3 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300">
{{ .Key }}
</h2>
@@ -90,8 +89,16 @@
{{ partial "article-link/card.html" . }}
{{ end }}
</section>
{{ if $cardViewScreenWidth }}
</div>
{{ else }}
<h2 class="mt-12 mb-3 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300">
{{ .Key }}
</h2>
<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3 {{ if $cardViewScreenWidth }} xl:grid-cols-4 2xl:grid-cols-5 {{ end }}">
{{ range .Pages }}
{{ partial "article-link/card.html" . }}
{{ end }}
</section>
{{ end }}
{{ end }}
@@ -100,9 +107,6 @@
{{ if $cardViewScreenWidth }}
<div class="relative w-screen max-w-[1600px] px-[30px] left-[calc(max(-50vw,-800px)+50%)]">
<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5">
{{ else }}
<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3">
{{ end }}
{{ if not $orderByWeight }}
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
{{ range .Pages }}
@@ -115,8 +119,21 @@
{{ end }}
{{ end }}
</section>
{{ if $cardViewScreenWidth }}
</div>
{{ else }}
<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3">
{{ 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 }}
</section>
{{ end }}
{{ end }}