Update with custom theme files
This commit is contained in:
parent
3b303aee07
commit
0c277c2458
45 changed files with 4324 additions and 11 deletions
44
layouts/shortcodes/figure.html
Normal file
44
layouts/shortcodes/figure.html
Normal file
|
@ -0,0 +1,44 @@
|
|||
{{ $img := $.Page.Resources.GetMatch (.Get "src") }}
|
||||
{{ $file := $.Page.Resources.GetMatch (.Get "link") }}
|
||||
|
||||
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
|
||||
{{- if .Get "link" -}}
|
||||
{{- if $file }}
|
||||
<a href="{{ $file.RelPermalink }}"{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
|
||||
{{ else }}
|
||||
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
{{ if $img }}
|
||||
<img class="figure__image"
|
||||
{{ with $img.Resize (printf "%dx%d webp" $img.Width $img.Height) }}
|
||||
src="{{ .RelPermalink }}"
|
||||
{{ end }}
|
||||
{{- if or ($img.Params.alt) (.Get "caption") }}
|
||||
alt="{{ with $img.Params.alt }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
|
||||
{{- end -}}
|
||||
{{- with $img.Params.title }} title="{{ . }}"{{ end -}}
|
||||
width="{{ $img.Width }}"
|
||||
height="{{ $img.Height }}"
|
||||
/>
|
||||
{{ end }}
|
||||
{{- if .Get "link" }}</a>{{ end -}}
|
||||
{{- if or (.Get "caption") ($img.Params.attr) -}}
|
||||
<figcaption class="figure__caption{{ if not (.Get "caption") }} figure__caption--no-height{{ end }}">
|
||||
{{- if $img.Params.attrlink -}}
|
||||
<a class="figcaption__attrlink" href="{{ $img.Params.attrlink }}"
|
||||
{{- with $img.Params.attrtarget }} target="{{ . }}"{{ end -}}
|
||||
{{- with $img.Params.attrrel }} rel="{{ . }}"{{ end -}}
|
||||
>
|
||||
{{- end -}}
|
||||
{{- with $img.Params.attr -}}<p class="figcaption__attr">{{ . | safeHTML }}{{ with $img.Params.attrlicence }} <span class="figcaption__licence">{{ . | safeHTML }}</span>{{ end }}</p>{{- end -}}
|
||||
{{- if $img.Params.attrlink -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{- with $img.Params.title -}}<h4 class="figcaption__title">{{ . }}</h4>{{- end -}}
|
||||
{{- if .Get "caption" -}}
|
||||
<p class="figcaption__caption">{{ .Get "caption" | markdownify }}</p>
|
||||
{{- end -}}
|
||||
</figcaption>
|
||||
{{- end -}}
|
||||
</figure>
|
Loading…
Add table
Add a link
Reference in a new issue