-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
harden auto-h1-description if .Content nil. figure htitles to h6. sit…
…emap also takes page bundle images.
- Loading branch information
Showing
4 changed files
with
48 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{{/* | ||
code copies entire from hugo built-in figure template, with grateful thanks. | ||
only addition is on .src, to get get image from page bundle with | ||
fingerprint rather than just a straight string input. also small rather | ||
than p for caption. | ||
*/}} | ||
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}> | ||
{{- if .Get "link" -}} | ||
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}> | ||
{{- end }} | ||
<img src="{{ ($.Page.Resources.GetMatch (.Get "src") | fingerprint).Permalink }}" | ||
{{- if or (.Get "alt") (.Get "caption") }} | ||
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}" | ||
{{- end -}} | ||
{{- with .Get "width" }} width="{{ . }}"{{ end -}} | ||
{{- with .Get "height" }} height="{{ . }}"{{ end -}} | ||
/> <!-- Closing img tag --> | ||
{{- if .Get "link" }}</a>{{ end -}} | ||
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}} | ||
<figcaption> | ||
{{ with (.Get "title") -}} | ||
<h6>{{ . }}</h6> | ||
{{- end -}} | ||
{{- if or (.Get "caption") (.Get "attr") -}}<small> | ||
{{- .Get "caption" | markdownify -}} | ||
{{- with .Get "attrlink" -}} | ||
<a href="{{ . }}"> | ||
{{- end -}} | ||
{{- .Get "attr" | markdownify -}} | ||
{{- if .Get "attrlink" }}</a>{{ end }}</small> | ||
{{- end }} | ||
</figcaption> | ||
{{- end }} | ||
</figure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters