40 lines
1.7 KiB
HTML
40 lines
1.7 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 }}-lightbox"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
|
|
<img src="{{ $imagethumbnail.RelPermalink }}"
|
|
{{- if or (.Get "alt") (.Get "caption") }}
|
|
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
|
|
{{- end -}}
|
|
{{- with .Get "width" }} width="{{ . }}"{{ end -}}
|
|
{{- with .Get "height" }} height="{{ . }}"{{ end -}}
|
|
/> <!-- Closing img tag -->
|
|
</a>
|
|
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
|
|
<figcaption>
|
|
{{ with (.Get "title") -}}
|
|
<h4>{{ . }}</h4>
|
|
{{- end -}}
|
|
{{- if or (.Get "caption") (.Get "attr") -}}<p>
|
|
{{- .Get "caption" | markdownify -}}
|
|
{{- with .Get "attrlink" }}
|
|
<a href="{{ . }}">
|
|
{{- end -}}
|
|
{{- .Get "attr" | markdownify -}}
|
|
{{- if .Get "attrlink" }}</a>{{ end }}</p>
|
|
{{- end }}
|
|
</figcaption>
|
|
{{- end }}
|
|
</figure>
|
|
<a href="#_" class="lightbox" id="{{ $image.RelPermalink | md5 }}-lightbox">
|
|
<img src="{{ $image.RelPermalink }}"
|
|
{{- if or (.Get "alt") (.Get "caption") }}
|
|
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
|
|
{{- end -}}
|
|
>
|
|
</a>
|
|
|