mykiwi/mykiwi.blogpublic Fork
⑂ c6cef41
Commits
⬇ Clone ▾
git clone https://git.rickub.com/mykiwi/mykiwi.blog.git
git clone ssh://git@rickub.com/mykiwi/mykiwi.blog.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

Prefix GoatCounter paths with the host

Each language is its own host and GoatCounter stores only a path, so fr.mykiwi.blog/ and mykiwi.blog/ were the same row. The boosted-navigation call passes its path explicitly, which count.js does not run through the path callback, so it adds the host itself.
Romain Gautier committed 2026-09-25T00:00:49+02:00 Browse files
c6cef41 parent: ff80112
modified blog/layouts/_default/baseof.html +12 -2
@@ -344,14 +344,24 @@
344344 });
345345 })();
346346 </script>
347+ {{- /* GoatCounter records only a path, and every language is its own host
348+ (fr.mykiwi.blog/ and mykiwi.blog/ would both be "/"), so the host goes
349+ in front of it: https://www.goatcounter.com/help/domains. Must be set
350+ before count.js runs. */}}
351+ <script>
352+ window.goatcounter = {path: (p) => location.host + p};
353+ </script>
347354 <script data-goatcounter="https://stats.mykiwi.blog/count"
348355 async src="//gc.zgo.at/count.js"></script>
349356 {{- /* count.js only sees the first full load; hx-boost navigations after
350357 that never reload <head>, so each one is reported by hand. The initial
351- load fires no swap event, so nothing is counted twice. */}}
358+ load fires no swap event, so nothing is counted twice. The path is
359+ passed explicitly (count.js would otherwise read the <link
360+ rel="canonical"> that hx-boost left behind from the first page), and an
361+ explicit path skips the callback above, so the host is added here. */}}
352362 <script>
353363 document.addEventListener("htmx:after:swap", () => {
354- window.goatcounter?.count?.({path: location.pathname + location.search, title: document.title});
364+ window.goatcounter?.count?.({path: location.host + location.pathname + location.search, title: document.title});
355365 });
356366 </script>
357367 {{ block "head" . }}{{ end }}
@@ -344,14 +344,24 @@
344 });344 });
345 })();345 })();
346 </script>346 </script>
347+ {{- /* GoatCounter records only a path, and every language is its own host
348+ (fr.mykiwi.blog/ and mykiwi.blog/ would both be "/"), so the host goes
349+ in front of it: https://www.goatcounter.com/help/domains. Must be set
350+ before count.js runs. */}}
351+ <script>
352+ window.goatcounter = {path: (p) => location.host + p};
353+ </script>
347 <script data-goatcounter="https://stats.mykiwi.blog/count"354 <script data-goatcounter="https://stats.mykiwi.blog/count"
348 async src="//gc.zgo.at/count.js"></script>355 async src="//gc.zgo.at/count.js"></script>
349 {{- /* count.js only sees the first full load; hx-boost navigations after356 {{- /* count.js only sees the first full load; hx-boost navigations after
350 that never reload <head>, so each one is reported by hand. The initial357 that never reload <head>, so each one is reported by hand. The initial
351- load fires no swap event, so nothing is counted twice. */}}358+ load fires no swap event, so nothing is counted twice. The path is
359+ passed explicitly (count.js would otherwise read the <link
360+ rel="canonical"> that hx-boost left behind from the first page), and an
361+ explicit path skips the callback above, so the host is added here. */}}
352 <script>362 <script>
353 document.addEventListener("htmx:after:swap", () => {363 document.addEventListener("htmx:after:swap", () => {
354- window.goatcounter?.count?.({path: location.pathname + location.search, title: document.title});364+ window.goatcounter?.count?.({path: location.host + location.pathname + location.search, title: document.title});
355 });365 });
356 </script>366 </script>
357 {{ block "head" . }}{{ end }}367 {{ block "head" . }}{{ end }}