dennogumi/layouts/shortcodes/imgthumb.html
2021-01-06 10:23:28 +01:00

55 lines
2.1 KiB
HTML

{{ $image := resources.GetMatch (.Get "src") }}
{{ $size := .Get "size" }}
{{/* Set the right options for Resize */}}
{{ $options := printf "%s %s %s" $size "jpg q90" "Box"}}
{{ $imagethumbnail := $image.Resize $options }}
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
<a href="#{{ $image.RelPermalink | md5 }}-img">
<img src="{{ $imagethumbnail.RelPermalink }}"
{{- if or (.Get "alt") (.Get "caption") }}
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
{{- end -}}
/>
</a>
<figure id="{{ $image.RelPermalink | md5 }}-img" class="lbox fade">
<img src="{{ $image.RelPermalink }}" {{- if or (.Get "alt") (.Get "caption") }}
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
{{- end -}}
/>
<a href="#_"></a>
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
<figcaption>
{{ with (.Get "title") -}}
<h5>{{ . }}</h5>
{{- end -}}
{{- if or (.Get "caption") (.Get "attr") -}}<p class="f5 center">
{{- .Get "caption" | markdownify -}}
{{- with .Get "attrlink" }}
<a href="{{ . }}">
{{- end -}}
{{- .Get "attr" | markdownify -}}
{{- if .Get "attrlink" }}</a>{{ end }}</p>
{{- end }}
</figcaption>
{{- end }}
</figure>
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
<figcaption class="center">
{{ with (.Get "title") -}}
<h4>{{ . }}</h4>
{{- end -}}
{{- if or (.Get "caption") (.Get "attr") -}}<p class="f5 lh-copy center">
{{- .Get "caption" | markdownify -}}
{{- with .Get "attrlink" }}
<a href="{{ . }}">
{{- end -}}
{{- .Get "attr" | markdownify -}}
{{- if .Get "attrlink" }}</a>{{ end }}</p>
{{- end }}
</figcaption>
{{- end }}
</figure>