hugo-theme/layouts/photos/single.html
2024-03-01 22:53:26 -05:00

38 lines
997 B
HTML

{{ partial "header.html" . }}
{{ partial "nav.html" . }}
<div class="content">
<h1>{{ .Title }}</h1>
{{ .Content }}
{{ $path := .Page.File.Path | strings.TrimSuffix (path.Ext .Page.File.Path) }}
{{ $path := printf "%s/*" $path }}
{{ $images := where (resources.Match $path ) "ResourceType" "eq" "image" }}
<div class="gallery">
{{ range $images }}
<div class="gallery-item">
{{ $thumbnail := .Process "resize x600 q50 jpeg" }}
{{ $public := .Process "jpeg q100" }}
<a href="{{ $public.RelPermalink }}" target="_blank"><img src="{{ $thumbnail.RelPermalink }}" /></a>
</div>
{{ end }}
</div>
{{ $file:= .Page.Params.archive }}
{{ with $file }}
{{ if not (resources.Get $file) }}
{{ errorf "Error: 'file' is a required parameter." }}
{{ end }}
<p>{{ i18n "gallery.download" }}</p>
{{- with resources.Get $file -}}
<a class="button" href="{{ .RelPermalink }}" download>Download {{ path.Ext $file }}</a>
{{- end -}}
{{ end }}
</div>
{{ partial "footer.html" . }}