Add photoswipe
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -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 -}}
|
||||
|
Reference in New Issue
Block a user