jakubb-hugo/layouts/photos/single.html

38 lines
1005 B
HTML
Raw Normal View History

2024-03-01 21:02:34 +00:00
{{ partial "header.html" . }}
{{ partial "nav.html" . }}
2024-03-01 21:02:34 +00:00
<div class="content">
<h1>{{ .Title }}</h1>
{{ .Content }}
2024-03-02 03:53:26 +00:00
2024-03-01 21:02:34 +00:00
{{ $path := .Page.File.Path | strings.TrimSuffix (path.Ext .Page.File.Path) }}
{{ $path := printf "%s/*" $path }}
{{ $images := where (resources.Match $path ) "ResourceType" "eq" "image" }}
2024-03-02 01:50:04 +00:00
<div class="gallery">
{{ range $images }}
<div class="gallery-item">
2024-03-07 03:44:22 +00:00
{{ $thumbnail := .Process "resize x400 q50 jpeg" }}
{{ $public := .Process "resize 2160x jpeg" }}
<a href="{{ $public.RelPermalink }}" target="_blank"><img src="{{ $thumbnail.RelPermalink }}" /></a>
2024-03-02 01:50:04 +00:00
</div>
{{ end }}
</div>
2024-03-01 21:02:34 +00:00
2024-03-02 03:53:26 +00:00
{{ $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>
2024-03-01 21:02:34 +00:00
{{ partial "footer.html" . }}