Refactor item into a template

This commit is contained in:
Tim Van Baak 2025-01-27 17:05:20 -08:00
parent c49b6c9088
commit 1057b54b3d

View File

@ -11,16 +11,7 @@
<span class="item-title">{{ or .Title .Id | raw }}</span> <span class="item-title">{{ or .Title .Id | raw }}</span>
{{- end }} {{- end }}
{{ define "content" -}} {{ define "item" -}}
<article class="center">
<span class="item-title">
<a href="#">Home</a>
[<a href="#">Active</a> | <a href="#">All</a>]
</span>
</article>
{{ if .Items }}
{{ range .Items }}
<article id="{{ .Source }}-{{ .Id }}"> <article id="{{ .Source }}-{{ .Id }}">
{{/* The item title is a clickable <summary> if there is body content */}} {{/* The item title is a clickable <summary> if there is body content */}}
@ -57,7 +48,20 @@
</article> </article>
{{ end }} {{ end }}
{{/* end range .Items */}} {{/* end define "item" */}}
{{ define "content" -}}
<article class="center">
<span class="item-title">
<a href="#">Home</a>
[<a href="#">Active</a> | <a href="#">All</a>]
</span>
</article>
{{ if .Items }}
{{ range .Items }}
{{ template "item" . }}
{{ end }}
<article class="center"> <article class="center">
<button>Deactivate All</button> <button>Deactivate All</button>