feat(shortcode): figure and figures flex box
All checks were successful
Deploy workflow / deploy (push) Successful in 33s

This commit is contained in:
Matthieu Bessat 2024-05-07 18:17:24 +02:00
parent 607b576cb7
commit 5171bcfdf2
14 changed files with 158 additions and 58 deletions

View file

@ -1,11 +1,23 @@
<!---
Fig img shortcode
-->
{{- if .Get "single" -}}
<div class="single-figure-container">
{{ end }}
<figure class="fig-img {{ with .Get "class" }}{{ . }}{{ end }}">
{{- if .Get "link" -}}
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
{{- end -}}
{{ $options := .Get "options" }}
{{ $img := (.Page.Resources.GetMatch (.Get "src")).Fit $options }}
<img src="{{ $img.RelPermalink }}"
{{ $options := or (.Get "options") "500x500 center" }}
{{ $permalink := "" }}
{{ if hasPrefix (.Get "src") "https://" }}
{{ $permalink = .Get "src" }}
{{ else }}
{{ $permalink = ((.Page.Resources.GetMatch (.Get "src")).Fill $options).Permalink }}
{{- end -}}
<img src="{{ $permalink }}"
{{- if or (.Get "alt") (.Get "caption") }}
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
{{- end -}}
@ -27,4 +39,6 @@
</figcaption>
{{- end }}
</figure>
{{- if .Get "single" -}}
</div>
{{ end }}

View file

@ -0,0 +1,3 @@
<div class="figures-grid">
{{ .Inner }}
</div>