Custom shortcode for figure, claning up whitespace. More custom stuff to come.
This commit is contained in:
parent
0ac512a91d
commit
511cd74910
1 changed files with 16 additions and 0 deletions
16
layouts/shortcodes/figure.html
Normal file
16
layouts/shortcodes/figure.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
|
||||
{{ with .Get "link" }}<a href="{{.}}">{{ end -}}
|
||||
<img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}" {{ end }}{{ with .Get "width" }}width="{{.}}" {{ end }}/>
|
||||
{{- if .Get "link" }}</a>{{ end }}
|
||||
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
|
||||
<figcaption>{{ if isset .Params "title" }}
|
||||
<h4>{{ .Get "title" }}</h4>{{ end }}
|
||||
{{ if or (.Get "caption") (.Get "attr") -}}
|
||||
<p>
|
||||
{{- .Get "caption" -}}
|
||||
{{ with .Get "attrlink" }} <a href="{{.}}">{{ end }}{{ .Get "attr" }}{{ if .Get "attrlink"}}</a>{{ end -}}
|
||||
</p>
|
||||
{{ end -}}
|
||||
</figcaption>
|
||||
{{ end -}}
|
||||
</figure>
|
||||
Loading…
Reference in a new issue