diff --git a/config/_default/params.toml b/config/_default/params.toml index 156fc51a..d3f5caf0 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -309,6 +309,11 @@ img-src = ["i.vimeocdn.com"] script-src = ["player.vimeo.com"] +# Core furniture: the lightbox shell (assets/lightbox.html) and its JS +# both load on every page so any [data-lightbox-trigger] works without per-page +# module registration. Kept out of the optional set on purpose — a shortcode +# registering it via AddModule is a render-order-dependent side effect that a +# head/footer consumer cannot rely on (see assets/lightbox.html). [modules.lightbox] - integration = "optional" + integration = "core" state = "defer" diff --git a/layouts/_partials/assets/lightbox-trigger.html b/layouts/_partials/assets/lightbox-trigger.html index 49cddb32..2a8b9888 100644 --- a/layouts/_partials/assets/lightbox-trigger.html +++ b/layouts/_partials/assets/lightbox-trigger.html @@ -1,15 +1,14 @@ {{/* - Convenience: render a lightbox trigger button for arbitrary content and - register the `lightbox` module dependency. Call with: + Convenience: render a lightbox trigger button for arbitrary content. The + lightbox shell and JS are core theme furniture (always present), so no + module registration is needed. Call with: {{ partial "assets/lightbox-trigger.html" (dict "page" . "source" "#my-figure") }} `source` is a CSS selector for the node to clone into the lightbox. Keep it unique: an id selector must not collide with a Hugo heading anchor (heading/page slug), or querySelector may match the wrong element. */}} -{{- $page := .page | default page -}} {{- $source := .source -}} {{- $icon := partial "utilities/GetThemeIcon.html" (dict "id" "lightboxExpand" "default" "fas expand") -}} -{{- partial "utilities/AddModule.html" (dict "page" $page "module" "lightbox") -}} - - -{{- end -}} +{{- $close := partial "utilities/GetThemeIcon.html" (dict "id" "lightboxClose" "default" "fas xmark") -}} + + + +