Simon Gardling 032679b34a setup
2023-10-11 17:38:05 -04:00

66 lines
2.8 KiB
HTML

{{ if .Content }}
<div class="content-margin">
{{- partial "content.html" (dict "ctx" . "content" .Content) -}}
</div>
{{ end }}
{{ if .Params.gallery_resources }}
{{ $res := .Site.GetPage .Params.gallery_resources }}
{{ $pages := $res.Resources.ByType "page" }}
{{ if $pages }}
<div class="content-margin gallery-layout">
{{ $max_idx := sub (len $pages) 1 }}
{{ range $index, $value := (sort $pages "Params.weight" "asc") }}
<div class="gallery-item">
{{ $title_link := .Params.gallery_title_link }}
{{ $img_link := .Params.gallery_img_link }}
{{ if .Params.gallery_img_src }}
<figure>
{{ if $img_link }}<a target="_blank" rel="noopener" href="{{ $img_link }}">{{ end }}
<img src="{{ .Params.gallery_img_src | absURL }}" alt="{{ .Title }}">
{{ if $img_link }}</a>{{ end }}
{{ with .Params.gallery_img_caption }}
<figcaption>
<article>
{{ . | safeHTML }}
</article>
</figcaption>
{{ end }}
</figure>
{{ end }}
{{ if .Title }}
<div class="gallery-item-title">
{{ if $title_link }}<a target="_blank" rel="noopener" href="{{ $title_link }}">{{ end }}
<span>{{- .Title -}}</span>
{{ if $title_link }}</a>{{ end }}
</div>
{{ end }}
{{ if .Content }}
<div class="gallery-item-content">
{{- partial "content.html" (dict "ctx" . "content" .Content) -}}
</div>
{{ end }}
{{ if .Params.gallery_statistic }}
<article class="gallery-item-statistic">
{{ range $stat := .Params.gallery_statistic }}
<div>{{ $stat.key | markdownify }}</div>
<div>{{ $stat.value | markdownify }}</div>
{{ end }}
</article>
{{ end }}
</div>
{{ end }}
</div>
{{ else }}
<span>{{ i18n "no_page_under_resouces" (dict "resources_name" "gallery_resources" "resources_path" .Params.gallery_resources ) }}</span>
{{ end }}
{{ else }}
<span>{{ i18n "resources_not_found" (dict "resources_name" "gallery_resources")}}</span>
{{ end }}