Add masonry

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-08-08 23:41:28 +02:00
parent 9d160b6890
commit 30f4d8d1e8
34 changed files with 328 additions and 9933 deletions

View File

@@ -0,0 +1,21 @@
{{ $imageData := partial "image/reflect.html" . }}
{{- with $imageData.image -}}
<figure class="captioned-image lightbox">
<a
href="{{- .RelPermalink -}}"
data-pswp-width="{{- .Width -}}"
data-pswp-height="{{- .Height -}}"
>
<img
src="{{- .RelPermalink -}}"
width="{{- .Width -}}"
height="{{- .Height -}}"
{{ with $imageData.title }}title="{{- . -}}"{{ end }}
{{ with $imageData.alt }}alt="{{- . -}}"{{ end }}
/>
</a>
{{ with $imageData.title }}
<figcaption>{{ . }}</figcaption>
{{ end }}
</figure>
{{- end -}}

View File

@@ -0,0 +1,22 @@
{{- $input := . -}}
{{- $src := $input -}}
{{- $title := "" -}}
{{- $alt := "" -}}
{{- if reflect.IsMap $input -}}
{{- $src = $input.src | default $input.path | default "" -}}
{{- $title = $input.title | default $input.caption | default "" -}}
{{- $alt = $input.alt | default $title -}}
{{- end -}}
{{ $result := dict "image" nil "title" $title "alt" $alt }}
{{- if $src -}}
{{- $isRemote := strings.HasPrefix $src "http" -}}
{{- $image := cond $isRemote (resources.GetRemote $src) (resources.Get $src) -}}
{{- $result = (dict "image" $image "title" $title "alt" $alt) -}}
{{- end -}}
{{- return $result -}}