From 5725be67d93e7255a11d508ae3b3c9328e0dda70 Mon Sep 17 00:00:00 2001 From: Nico Kaiser Date: Mon, 4 Nov 2024 18:44:06 +0000 Subject: [PATCH] feat: pass gallery params to JS --- exampleSite/config/_default/hugo.toml | 4 ++++ layouts/partials/head.html | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/exampleSite/config/_default/hugo.toml b/exampleSite/config/_default/hugo.toml index 4c1e95f8..fbaaf1b6 100644 --- a/exampleSite/config/_default/hugo.toml +++ b/exampleSite/config/_default/hugo.toml @@ -23,6 +23,10 @@ title = "Gallery" #website = "https://example.com" #mastodon = "https://example.com" #pixelfed = "https://example.com" + [params.gallery] + #boxSpacing = 10 + #targetRowHeight = 288 + #targetRowHeightTolerance = 0.25 [outputs] home = ["HTML", "RSS"] diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 07367745..bb8e93c7 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -28,9 +28,9 @@ "arrowNextTitle" (i18n "arrowNextTitle") "errorMsg" (i18n "errorMsg") "downloadTitle" (i18n "downloadTitle") - "boxSpacing" 10 - "targetRowHeight" 288 - "targetRowHeightTolerance" 0.25 + "boxSpacing" (default 10 .Site.Params.gallery.boxSpacing) + "targetRowHeight" (default 288 .Site.Params.gallery.targetRowHeight) + "targetRowHeightTolerance" (default 0.25 .Site.Params.gallery.targetRowHeightTolerance) }} {{ $js := resources.Get "js/main.js" | js.Build (dict "minify" true "params" $params) | resources.Fingerprint }}