fix(legal): make cookie-banner privacy link baseURL-aware (#215)
Use a data-file placeholder for cookie-consent privacy links and replace it through Hugo's relURL helper before Cookie Consent initializes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Juan Manuel Servera committed
May 25, 2026 at 23:53 UTC
a180d6e70fb2f220aa04bc256edb6b9556bf59c8
4 files changed
+27
-4
.squad/agents/hermes/history.md
+5
@@ -27,3 +27,8 @@
27
**Files Created:**
28
- `content/privacy/_index.md` — Hugo privacy policy (~580 words, covers all GDPR minima)
29
- `data/cookieconsent.json` — Cookie Consent v3 config (plain English copy, no manipulation)
30
+
31
+## Cookie Banner BaseURL-Aware Links — 2026-05-25
32
+
33
+- Cookie-banner in-site links must not hardcode root-relative paths like `/privacy/` because GitHub project Pages deploys SquadScope under `/SquadScope/`.
34
+- Data-file legal copy should use placeholders such as `__PRIVACY_URL__`, with Hugo partials substituting them through URL helpers (`relURL` or `absURL`) at render time.
.squad/decisions/inbox/hermes-baseurl-aware-data-links.md
new
+16
@@ -0,0 +1,16 @@
1
+# BaseURL-aware links in data files
2
+
3
+Date: 2026-05-25
4
+Owner: Hermes
5
+
6
+## Decision
7
+
8
+Links inside `data/*.json` files must use `__TOKEN__` placeholders substituted by partials with Hugo URL helpers; never hardcode `/path/` prefixes inside data files.
9
+
10
+## Rationale
11
+
12
+SquadScope is currently deployed on GitHub project Pages under `/SquadScope/`, so root-relative links such as `/privacy/` resolve outside the site and can 404. If the site later moves to an apex/custom domain, Hugo URL helpers will render the same logical route correctly without changing legal-copy JSON.
13
+
14
+## Implementation note
15
+
16
+For cookie-consent copy, `data/cookieconsent.json` uses `__PRIVACY_URL__`, and `layouts/partials/cookie-consent.html` replaces it with `"privacy/" | relURL` before initializing Cookie Consent.
data/cookieconsent.json
+3
-3
@@ -25,11 +25,11 @@
25
"en": {
26
"consentModal": {
27
"title": "We use cookies",
28
- "description": "We use cookies to understand how you use SquadScope. Some are necessary for the site to work; others help us improve your experience. You're in control — you can choose which cookies to accept. Read more in our <a href=\"/privacy/\">privacy policy</a>.",
28
+ "description": "We use cookies to understand how you use SquadScope. Some are necessary for the site to work; others help us improve your experience. You're in control — you can choose which cookies to accept. Read more in our <a href=\"__PRIVACY_URL__\">privacy policy</a>.",
29
"acceptAllBtn": "Accept all",
30
"acceptNecessaryBtn": "Reject all",
31
"showPreferencesBtn": "Customize",
32
- "footer": "<a href=\"/privacy/\">Privacy policy</a>"
32
+ "footer": "<a href=\"__PRIVACY_URL__\">Privacy policy</a>"
33
},
34
"preferencesModal": {
35
"title": "Manage Your Cookies",
@@ -50,7 +50,7 @@
50
},
51
{
52
"title": "More information",
53
- "description": "For detailed information about how we use your data, retention periods, and your privacy rights, please see our <a href=\"/privacy/\" target=\"_blank\">privacy policy</a>."
53
+ "description": "For detailed information about how we use your data, retention periods, and your privacy rights, please see our <a href=\"__PRIVACY_URL__\" target=\"_blank\">privacy policy</a>."
54
}
55
]
56
}
layouts/partials/cookie-consent.html
+3
-1
@@ -1,7 +1,9 @@
1
{{- $cfg := .Site.Data.cookieconsent -}}
2
+{{- $cfgJSON := $cfg | jsonify -}}
3
+{{- $cfgJSON = replace $cfgJSON "__PRIVACY_URL__" ("privacy/" | relURL) -}}
4
<link rel="stylesheet" href="{{ "vendor/cookieconsent/cookieconsent.css" | relURL }}">
5
<script>
4
- window.SquadScopeCookieConsent = {{ $cfg | jsonify | safeJS }};
6
+ window.SquadScopeCookieConsent = {{ $cfgJSON | safeJS }};
7
</script>
8
<script>
9
(function () {