Skip to content
This repository has been archived by the owner on Jun 10, 2023. It is now read-only.

update figure shortcode to support link, target, rel attributes #331

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions layouts/shortcodes/figure.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{{ if .Get "src" }}
<figure class="{{ with .Get "position"}}{{ . }}{{ else -}} left {{- end }}" >
{{- if .Get "link" -}}
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
{{- end -}}
<img src="{{ .Get "src" | safeURL }}" {{ with .Get "alt" }} alt="{{ . | plainify }}" {{ end }} {{ with .Get "style" }} style="{{ . | safeCSS }}" {{ end }} />
{{- if .Get "link" }}</a>{{ end -}}
{{ if .Get "caption" }}
<figcaption class="{{ with .Get "captionPosition"}}{{ . }}{{ else -}} center {{- end }}" {{ with .Get "captionStyle" }} style="{{ . | safeCSS }}" {{ end }}>{{ .Get "caption" | markdownify }}</figcaption>
{{ end }}
Expand Down