feat(shortcode): figure and figures flex box
All checks were successful
Deploy workflow / deploy (push) Successful in 33s
All checks were successful
Deploy workflow / deploy (push) Successful in 33s
This commit is contained in:
parent
607b576cb7
commit
5171bcfdf2
14 changed files with 158 additions and 58 deletions
|
|
@ -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 }}
|
||||
|
|
|
|||
3
layouts/shortcodes/figures-grid.html
Normal file
3
layouts/shortcodes/figures-grid.html
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<div class="figures-grid">
|
||||
{{ .Inner }}
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue