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
This commit is contained in:
Anirban Basu authored and GitHub committed 2022-09-17 11:04:33 +01:00
1 parent 71f51091fb
commit c85924ba3e
1 file changed
+1 -1
@@ -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 }}
}
})});
</script>