podcast-mod/layouts/podcast/section.html.html
Florian Maury 63246546b3 initial
2024-10-26 10:25:43 +02:00

39 lines
1.3 KiB
HTML

<header><h1>{{ printf (T "welcome") .Title }}</h1></header>
<nav>
{{- $season_cnt := 0 -}}
{{- $season_lst := slice -}}
{{- range .Sections -}}
{{- if eq .Type "season" -}}
{{- $season_cnt = add $season_cnt 1 -}}
{{- $season_lst = collections.Append (dict "number" .Params.season.number "title" .Params.season.title "object" .) $season_lst -}}
{{- end -}}
{{- end -}}
{{- if gt $season_cnt 0 -}}
<section>
<h2>
{{- printf "%s%s" (T "seasons" | strings.FirstUpper) (T "colon") -}}
</h2>
{{- $season_lst = collections.Sort $season_lst "number" "asc" -}}
{{- end -}}
{{- range $season_lst -}}
<article>
<p><a href="{{- (collections.Index . "object").RelPermalink -}}">{{- printf "%s %d%s %s" (T "season" | strings.FirstUpper) (collections.Index . "number") (T "colon") (collections.Index . "title") -}}</a></p>
</article>
{{- end -}}
</section>
<section>
<h2>
{{- printf "%s%s" (T "episodes" | strings.FirstUpper ) (T "colon") -}}
</h2>
{{ range .RegularPagesRecursive }}
<article>
<p><a href="{{- .RelPermalink -}}">
{{- if .Params.season -}}
{{- printf "%s %d%s " (T "season" | strings.FirstUpper) (collections.Index .Params.season "number") (T "colon") -}}
{{- end -}}
{{- .Title -}}
</a></p>
</article>
{{ end }}
</section>
</nav>