diff options
Diffstat (limited to 'themes/LoveIt/layouts/shortcodes/image.html')
-rw-r--r-- | themes/LoveIt/layouts/shortcodes/image.html | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/themes/LoveIt/layouts/shortcodes/image.html b/themes/LoveIt/layouts/shortcodes/image.html new file mode 100644 index 0000000..ec010f0 --- /dev/null +++ b/themes/LoveIt/layouts/shortcodes/image.html @@ -0,0 +1,29 @@ +{{- $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 }}> + {{- partial "plugin/img.html" $options -}} + <figcaption class="image-caption"> + {{- . | safeHTML -}} + </figcaption> + </figure> +{{- else -}} + {{- partial "plugin/img.html" $options -}} +{{- end -}} |