summaryrefslogtreecommitdiffstats
path: root/layouts/shortcodes
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-04-05 09:34:21 +0200
committerDanilo M. <danix@danix.xyz>2026-04-05 09:34:21 +0200
commit043ec4b61363fe28b2d2d8ac9e17e9386bf7175d (patch)
tree4d650da608f1a03697d3aacaf76d916c08a0d2d0 /layouts/shortcodes
parentc262af894a95d6473e3bf8a2f8c0c85caa6b3b8b (diff)
downloaddanixxyz-theme-043ec4b61363fe28b2d2d8ac9e17e9386bf7175d.tar.gz
danixxyz-theme-043ec4b61363fe28b2d2d8ac9e17e9386bf7175d.zip
feat: add figure shortcode and documentation
Ported figure shortcode from previous theme. Wraps content in semantic <figure> element with optional title, caption, attribution, and link support. Typical usage: {{< figure caption="Image caption" attr="Photo by Someone" >}} {{< img src="image.jpg" alt="Description" >}} {{< /figure >}} Also updated CONTENT_GUIDE with comprehensive usage examples and parameters. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r--layouts/shortcodes/figure.html27
1 files changed, 27 insertions, 0 deletions
diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html
new file mode 100644
index 0000000..81f86de
--- /dev/null
+++ b/layouts/shortcodes/figure.html
@@ -0,0 +1,27 @@
+{{/*
+ * This version of the figure shortcode needs to be closed and doesn't
+ * add an image itself, but relies on the img.html shortcode to provide
+ * a responsive image instead.
+ */}}
+<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
+ {{- if .Get "link" -}}
+ <a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
+ {{- end -}}
+ {{- .Inner -}}
+ {{- if .Get "link" }}</a>{{ end -}}
+ {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
+ <figcaption>
+ {{ with (.Get "title") -}}
+ <h4>{{ . }}</h4>
+ {{- end -}}
+ {{- if or (.Get "caption") (.Get "attr") -}}<p>
+ {{- .Get "caption" | markdownify -}}
+ {{- with .Get "attrlink" }}
+ <a href="{{ . }}">
+ {{- end -}}
+ {{- .Get "attr" | markdownify -}}
+ {{- if .Get "attrlink" }}</a>{{ end }}</p>
+ {{- end }}
+ </figcaption>
+ {{- end }}
+</figure>