Skip to content

Commit bbe4eb6

Browse files
Use image partial (#540)
1 parent 8283131 commit bbe4eb6

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{- if .data.target -}}<a href="{{ .data.target }}">{{- end -}}
2+
<img src="{{ .data.src }}" alt="{{ .data.alt }}"
3+
{{- with .data.align }} class="align-{{ . }}"{{ end -}}
4+
{{- with .data.width }} width="{{ . }}"{{ end -}}
5+
{{- with .data.height }} height="{{ . }}"{{ end -}}
6+
>
7+
{{- if .data.target }}</a>{{ end -}}

layouts/shortcodes/image.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,4 @@
3434
*/}}
3535

3636
{{- $data := .Inner | transform.Unmarshal -}}
37-
{{- if $data.target -}}<a href="{{ $data.target }}">{{- end -}}
38-
<img src="{{ $data.src }}" alt="{{ $data.alt }}"
39-
{{- with $data.align }} class="align-{{ . }}"{{ end -}}
40-
{{- with $data.width }} width="{{ . }}"{{ end -}}
41-
{{- with $data.height }} height="{{ . }}"{{ end -}}
42-
>
43-
{{- if $data.target }}</a>{{ end -}}
37+
{{- partial "_elements/image.html" (dict "data" $data) -}}

0 commit comments

Comments
 (0)