From 82baf3c72e8aeec606b2c3fcd34b7ad8b4e1bc40 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 28 Jun 2024 16:03:38 +0200 Subject: make goatcounter URL configurable --- config.toml | 2 ++ internal/config/config.go | 1 + templates/page.templ | 15 +++++---------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/config.toml b/config.toml index db9bab6..40efd77 100644 --- a/config.toml +++ b/config.toml @@ -19,6 +19,8 @@ domains = [ oidc_host = "https://id.alanpearce.eu/" +goatcounter = "https://alanpearce-eu.goatcounter.com/count" + [[taxonomies]] name = "tags" feed = true diff --git a/internal/config/config.go b/internal/config/config.go index 7d43462..b429333 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -38,6 +38,7 @@ type Config struct { Description string DomainStartDate string `toml:"domain_start_date"` OriginalDomain string `toml:"original_domain"` + GoatCounter URL `toml:"goatcounter"` Domains []string OIDCHost URL `toml:"oidc_host"` Taxonomies []Taxonomy diff --git a/templates/page.templ b/templates/page.templ index 1dbd345..7a43485 100644 --- a/templates/page.templ +++ b/templates/page.templ @@ -2,7 +2,6 @@ package templates import ( "io/fs" - "net/url" "website/internal/config" ) @@ -74,7 +73,7 @@ templ Page(site *config.Config, page PageSettings) { Site source code is MIT - @counter(page.Path, page.Title) + @counter(site, page.Path, page.Title) if site.InjectLiveReload { +templ counter(config *config.Config, path string, title string) { + } -- cgit 1.4.1