Skip to content

Commit

Permalink
Use image partial (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarrodmillman authored Mar 8, 2024
1 parent 8283131 commit bbe4eb6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 7 additions & 0 deletions layouts/partials/_elements/image.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- if .data.target -}}<a href="{{ .data.target }}">{{- end -}}
<img src="{{ .data.src }}" alt="{{ .data.alt }}"
{{- with .data.align }} class="align-{{ . }}"{{ end -}}
{{- with .data.width }} width="{{ . }}"{{ end -}}
{{- with .data.height }} height="{{ . }}"{{ end -}}
>
{{- if .data.target }}</a>{{ end -}}
8 changes: 1 addition & 7 deletions layouts/shortcodes/image.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,4 @@
*/}}

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

0 comments on commit bbe4eb6

Please sign in to comment.