From c85924ba3e5f30dd6e31b1d357c9ea8b0dcb7650 Mon Sep 17 00:00:00 2001 From: Anirban Basu Date: Sat, 17 Sep 2022 19:04:33 +0900 Subject: [PATCH] fix: use absolute path in cookie_consent.html (#2804) Adding `site.GetPage /privacy.md` to reflect the absolute path to `privacy.md`, as per the Hugo documentation for GetPage. This should force Hugo to only link to a `/privacy.md` page at the root of the site and prevent Hugo searching for unrelated pages with `privacy` in the name (as it currently does, if for example you also have a /tags/privacy/ page). Note that currently there's a Hugo bug where Hugo does not respect absolute paths in `site.GetPage`. Hence, Hugo can still return other unrelated pages (for example any other pages that have `privacy....` in the filename) until this bug is fixed: https://github.com/gohugoio/hugo/issues/10243 --- modules/wowchemy/layouts/partials/cookie_consent.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/wowchemy/layouts/partials/cookie_consent.html b/modules/wowchemy/layouts/partials/cookie_consent.html index e5a797b4..bd8ca46f 100644 --- a/modules/wowchemy/layouts/partials/cookie_consent.html +++ b/modules/wowchemy/layouts/partials/cookie_consent.html @@ -24,7 +24,7 @@ "message": {{ i18n "cookie_message" | default "This website uses cookies to ensure you get the best experience on our website." }}, "dismiss": {{ i18n "cookie_dismiss" | default "Got it!" }}, "link": {{ i18n "cookie_learn" | default "Learn more" }}, - "href": {{ with site.GetPage "privacy.md" }}{{ printf "%s" .RelPermalink }}{{ else }}"https://www.cookiesandyou.com"{{ end }} + "href": {{ with site.GetPage "/privacy.md" }}{{ printf "%s" .RelPermalink }}{{ else }}"https://www.cookiesandyou.com"{{ end }} } })});