www-from-model/layouts/_partials/related-by-category-lists.html
Michael Hanke 54ef002a67
All checks were successful
Deploy on webserver / Build site and deploy on success (push) Successful in 1m14s
fix: make collapsible expand to full content
2026-05-21 07:01:14 +02:00

35 lines
1.5 KiB
HTML

<section>
<div class="rounded-lg shadow-lg overflow-hidden">
{{ range $index, $items := (.Pages.GroupBy "Type") }}
{{ if eq .Key "page" }}{{ else }}
<div class="rounded-lg shadow-lg overflow-hidden">
<input type="checkbox" id="accordion{{ $index }}" class="peer hidden">
<label for="accordion{{ $index }}"
class="flex items-center justify-between p-4 cursor-pointer transition-colors"
>
<span class="text-lg font-semibold">{{ .Key | title }}</span>
<svg class="w-6 h-6 transition-transform peer-checked:rotate-180"
fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round"
stroke-width="2" d="M19 9l-7 7-7-7"></path>
</svg>
</label>
<div class="pl-8 max-h-0 overflow-hidden transition-all duration-300 peer-checked:max-h-full">
<ul class="mb-4 text-base list-disc list-outside">
{{ $linkpartial := printf "related-%s-list-item.html" .Key }}
{{ $linktmpl := printf "_partials/%s" $linkpartial }}
{{ range .Pages.ByParam "sortkey" }}
<li>
{{ if templates.Exists $linktmpl }}
{{ partial $linkpartial . }}
{{ else }}
{{ partial "related-list-item.html" . }}
{{ end }}
</li>
{{end}}
</ul>
</div>
</div>
{{ end }}
{{ end }}
</section>