diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-09-29 19:17:13 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-10-01 07:51:11 +0200 |
| commit | 4c41e477e13d37e187c8de4225c7e8056bd9ed28 (patch) | |
| tree | 33a7b51a0ed2c2ae207fc8f89f1454ccb77596a5 /layouts/shortcodes/img.html | |
| parent | 4720b07e9f18915cf1f6466245a92dedd11fdc55 (diff) | |
Internalise theme
Diffstat (limited to 'layouts/shortcodes/img.html')
| -rw-r--r-- | layouts/shortcodes/img.html | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html index a0673a3..45ce3da 100644 --- a/layouts/shortcodes/img.html +++ b/layouts/shortcodes/img.html @@ -1,23 +1,16 @@ -{{/* Image Resources */}} -{{ $img := .Page.Resources.GetMatch (printf "%s" (.Get "src" | safeURL ))}} -{{ $alt := .Get "alt"}} +{{ $img := .Page.Resources.GetMatch (printf "%s" (.Get "src" | safeURL )) }} +{{ $alt := .Get "alt" }} +{{ $caption := .Get "caption" }} +{{ $captionPosition := .Get "caption-position" }} -{{/* Image Processing */}} -{{ $command := .Get "size-method" }} -{{ $options := .Get "size-format" }} -{{ if eq $command "Fit"}} - {{ $img = $img.Fit $options }} -{{ else if eq $command "Resize"}} - {{ $img = $img.Resize $options }} -{{ else if eq $command "Fill"}} - {{ $img = $img.Fill $options }} -{{ else if eq $command "Crop"}} - {{ $img = $img.Crop $options }} -{{ end }} - -{{/* Position */}} -{{ $position := .Get "position" }} - -<figure class='mb-5{{ if eq $position "center" }} flex justify-center{{ end }}'> - <img src="{{ $img.RelPermalink }}" {{ with $alt }}alt="{{ . }}"{{end}} width="{{ $img.Width }}" height="{{ $img.Height }}" > +<figure class='mb-5'> + <img src="{{ $img.RelPermalink }}" {{ with $alt }} alt="{{ . }}" {{ end }} width="{{ $img.Width }}" height="{{ $img.Height }}" /> + + {{ with $caption }} + <figcaption + class='{{ if eq $captionPosition "center" }} flex justify-center {{ else if eq $captionPosition "end" }} flex justify-end {{ end }}' + > + {{ . }} + </figcaption> + {{ end }} </figure>
\ No newline at end of file |
