We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 512dbb5 commit 9d4cbd6Copy full SHA for 9d4cbd6
layouts/shortcodes/img.html
@@ -0,0 +1,12 @@
1
+{{ $src := (.Page.Resources.GetMatch (printf "**%s*" (.Get "src"))) }}
2
+{{- if .Get "link" -}}
3
+<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
4
+{{- end }}
5
+<img {{ with .Get "class" }} class="{{ . }}"{{ end }} src="{{ if $src }}{{ $src.RelPermalink }}{{ else }}{{ .Get "src" }}{{ end }}"
6
+{{- if or (.Get "alt") (.Get "caption") }}
7
+alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
8
+{{- end -}}
9
+{{- with .Get "width" }} width="{{ . }}"{{ end -}}
10
+{{- with .Get "height" }} height="{{ . }}"{{ end -}}
11
+/> <!-- Closing img tag -->
12
+{{- if .Get "link" }}</a>{{ end -}}
0 commit comments