From 5250576744fae51c87c70ce91ca136b8e473863c Mon Sep 17 00:00:00 2001 From: welpo Date: Thu, 10 Aug 2023 17:26:39 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A1=20chore:=20add=20comments=20explai?= =?UTF-8?q?ning=20use=20of=20`get=5Frandom`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/shortcodes/image_toggler.html | 3 +++ templates/shortcodes/multilingual_quote.html | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/templates/shortcodes/image_toggler.html b/templates/shortcodes/image_toggler.html index 09fca1a..6a64995 100644 --- a/templates/shortcodes/image_toggler.html +++ b/templates/shortcodes/image_toggler.html @@ -1,3 +1,6 @@ +{# The `random_id` ensures that each instance of the shortcode has a "unique" id #} +{# allowing individual interactive elements (like toggles) to function correctly. #} +{# This avoids conflicts when multiple instances of the shortcode are used. #} {%- set random_id = get_random(end=100000) -%} {% set default_meta = get_image_metadata(path=default_src, allow_missing=true) %} diff --git a/templates/shortcodes/multilingual_quote.html b/templates/shortcodes/multilingual_quote.html index 556bd1d..dda2484 100644 --- a/templates/shortcodes/multilingual_quote.html +++ b/templates/shortcodes/multilingual_quote.html @@ -6,6 +6,10 @@ {%- set close_quote = "”" -%} {%- endif -%} +{# The `random_id` ensures that each instance of the shortcode has a "unique" id #} +{# allowing individual interactive elements (like toggles) to function correctly. #} +{# This avoids conflicts when multiple instances of the shortcode are used. #} +{# More context: https://github.com/welpo/tabi/issues/82 #} {%- set random_id = get_random(end=100000) -%}