m2.nz/themes/LoveIt/layouts/shortcodes/image.html

30 lines
1.3 KiB
HTML
Raw Normal View History

2022-05-08 06:47:31 +00:00
{{- $options := cond .IsNamedParams (.Get "src") (.Get 0) | dict "Src" -}}
{{- $options = cond .IsNamedParams (.Get "alt") (.Get 1) | .Page.RenderString | dict "Alt" | merge $options -}}
{{- $caption := cond .IsNamedParams (.Get "caption") (.Get 2) | .Page.RenderString -}}
{{- $options = dict "Caption" $caption | merge $options -}}
{{- if .IsNamedParams -}}
{{- $options = dict "Title" (.Get "title") | merge $options -}}
{{- $options = dict "SrcSmall" (.Get "src_s") | merge $options -}}
{{- $options = dict "SrcLarge" (.Get "src_l") | merge $options -}}
{{- $options = dict "Height" (.Get "height") | merge $options -}}
{{- $options = dict "Width" (.Get "width") | merge $options -}}
{{- $options = .Get "linked" | ne false | dict "Linked" | merge $options -}}
{{- $options = dict "Rel" (.Get "rel") | merge $options -}}
{{- else -}}
{{- $options = cond $caption true false | dict "Linked" | merge $options -}}
{{- end -}}
{{- $options = dict "Resources" .Page.Resources | merge $options -}}
{{- with $caption -}}
<figure{{ with cond $.IsNamedParams ($.Get "class") "" }} class="{{ . }}"{{ end }}>
2024-04-07 02:32:03 +00:00
{{- partial "plugin/img.html" $options -}}
2022-05-08 06:47:31 +00:00
<figcaption class="image-caption">
{{- . | safeHTML -}}
</figcaption>
</figure>
{{- else -}}
2024-04-07 02:32:03 +00:00
{{- partial "plugin/img.html" $options -}}
2022-05-08 06:47:31 +00:00
{{- end -}}