From 2cfca058d569e33b2e6c34dcf2a266d95c7604b0 Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman <the@jeffreyfreeman.me> Date: Sat, 21 Oct 2023 20:08:04 -0400 Subject: [PATCH] Added ability to click on and expand images through figure shortcode --- CHANGELOG.md | 1 + layouts/shortcodes/figure.html | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1e7da501..31bff3723 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * When a post has an `image_header` parameter this image is set as an attachment to ActivityPub posts * Fixed some poor CSS rendering for quote-box. +* the `figure` shortcode will now make images clickable to see the full size. ## 2.1.0 diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index eeb792d0f..6a2cd5c57 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -1,4 +1,5 @@ <figure> + {{- if .Get "src" }}<a href="{{ .Get "src" }}">{{ end }} <img {{ with .Get "src" }}src="{{ . }}"{{ end }} {{ with .Get "alt" }}alt="{{ range (split . " ") }}{{ . }} {{ end }}"{{ end }} @@ -9,5 +10,6 @@ {{ with .Get "width" }}width="{{ . }}"{{ end }} {{ with .Get "height" }}height="{{ . }}"{{ end }} {{ with .Get "layout" }}layout="{{ . }}"{{ end }} /> + {{- if .Get "src" }}</a>{{ end }} {{ with .Get "caption" }}<figcaption>{{ . }}</figcaption>{{ end }} - </figure> \ No newline at end of file +</figure> -- GitLab