Add photoswipe

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-08-08 19:44:04 +02:00
parent 8e240134b0
commit 9d160b6890
21 changed files with 9949 additions and 62 deletions

View File

@@ -2,15 +2,28 @@
{{- $caption := .caption -}}
{{- $alt := default .caption .alt -}}
{{ if $path }}
<figure class="image">
<img
src="{{- $path | absURL -}}"
{{ with $caption }}title="{{- . -}}"{{ end }}
{{ with $alt }}alt="{{- . -}}"{{ end }}
/>
{{ with $caption }}
<figcaption>{{ . }}</figcaption>
{{ end }}
</figure>
{{ end }}
{{- if $path -}}
{{- $isRemote := strings.HasPrefix $path "http" -}}
{{- $image := cond $isRemote (resources.GetRemote $path) (resources.Get $path) -}}
{{- if $image -}}
<figure class="image gallery">
<a
href="{{- $image.RelPermalink -}}"
data-pswp-width="{{- $image.Width -}}"
data-pswp-height="{{- $image.Height -}}"
>
<img
src="{{- $image.RelPermalink -}}"
width="{{- $image.Width -}}"
height="{{- $image.Height -}}"
{{ with $caption }}title="{{- . -}}"{{ end }}
{{ with $alt }}alt="{{- . -}}"{{ end }}
/>
</a>
{{ with $caption }}
<figcaption>{{ . }}</figcaption>
{{ end }}
</figure>
{{- end -}}
{{- end -}}