summaryrefslogtreecommitdiff
path: root/layouts/shortcodes
diff options
context:
space:
mode:
authorMichał M. Sapka <michal@sapka.me>2023-02-08 13:18:17 +0100
committerMichał M. Sapka <michal@sapka.me>2023-02-08 13:19:54 +0100
commit6e038781e06adbf623d43b82a312e90f402496be (patch)
tree06da4a3355604ebc34d905dad0a4e6f595515781 /layouts/shortcodes
parente102ea1883f4281b6e4172023f849f538a0b58f4 (diff)
feat: article for 2023-02-08
and centered imagem shortcde.
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r--layouts/shortcodes/img-center.html16
1 files changed, 16 insertions, 0 deletions
diff --git a/layouts/shortcodes/img-center.html b/layouts/shortcodes/img-center.html
new file mode 100644
index 0000000..398cccc
--- /dev/null
+++ b/layouts/shortcodes/img-center.html
@@ -0,0 +1,16 @@
+{{- $file := .Get 0 }}
+{{- $path := printf "content_images/%s" $file}}
+{{- $img := resources.Get $path }}
+{{- $caption := .Get 1 }}
+{{- $source := .Get 2 }}
+{{- $img = $img.Resize "500x" }}
+<figure>
+ <img class="centered" alt="{{ $caption }}" src="{{ $img.RelPermalink }}" width="{{ $img.Width }}" height="{{ $img.Height }}">
+ <figcaption>
+ {{ $caption }}
+
+ {{- if $source }}
+ <a href="{{ $source }}" target="_blank" title="source">[source]</a>
+ {{ end }}
+ </figcaption>
+</figure>