summaryrefslogtreecommitdiff
path: root/layouts/shortcodes/img.html
blob: 40002cfc8945da455810e23a1235bd524ea6672c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!--
	class: class of figure
	link: url of image
	id: id of image
	alt: alt text
	caption: caption
	mouse: text when moused over
	width: fixed width (ex: 600px, 80%)
	maxwidth: max width (ex: 800px)
-->

<figure {{ with .Get "class" }}class="{{.}}"{{ end -}}>
	{{- with .Get "link"}}<a href="{{.}}">{{ end -}}
		<img
			src="{{ .Get "src" }}"
			{{- with .Get "mouse" }} title="{{.}}"{{ end -}}
			{{- with .Get "id" }} id="{{.}}"{{ end -}}
			{{- with .Get "alt" }} alt="{{.}}"{{ end -}}
			{{- if or (.Get "width") (.Get "maxwidth") }}
			style="
				{{- with .Get "width" }}width: {{.}};{{ end -}}
				{{- with .Get "maxwidth" }}max-width: {{.}};{{ end -}}
				height: auto;
			"
			{{- end -}}
		>
	{{- if .Get "link"}}</a>{{ end -}}

	{{- with .Get "caption" -}}
	<figcaption>
		{{- . -}}
	</figcaption>
	{{- end -}}
</figure>