From 9771b5ba4bff0ac28ac303c6efe13df90441ad6e Mon Sep 17 00:00:00 2001 From: Salar Rahmanian Date: Sun, 27 Oct 2024 12:15:24 -0700 Subject: [PATCH] add custom js for plausible --- config.toml | 2 +- templates/partials/analytics.html | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 templates/partials/analytics.html diff --git a/config.toml b/config.toml index a50b679..57b4c56 100644 --- a/config.toml +++ b/config.toml @@ -214,7 +214,7 @@ copyright = "© $CURRENT_YEAR $AUTHOR $SEPARATOR Unless otherwise noted, the con allowed_domains = [ { directive = "font-src", domains = ["'self'", "data:"] }, { directive = "img-src", domains = ["'self'", "https://*", "data:"] }, - { directive = "script-src", domains = ["'self'", "https://comments.softinio.com/js/embed.min.js", "https://static.cloudflareinsights.com", "https://a.softinio.net"] }, + { directive = "script-src", domains = ["'self'", "https://comments.softinio.com/js/embed.min.js", "https://static.cloudflareinsights.com"] }, { directive = "style-src", domains = ["'self'"] }, { directive = "frame-src", domains = ["player.vimeo.com", "https://www.youtube-nocookie.com", "https://watch.softinio.com", "https://notes.softinio.com/embed"] }, ] diff --git a/templates/partials/analytics.html b/templates/partials/analytics.html new file mode 100644 index 0000000..cf5c0d2 --- /dev/null +++ b/templates/partials/analytics.html @@ -0,0 +1,28 @@ +{% set analytics_service = config.extra.analytics.service %} +{% set analytics_id = config.extra.analytics.id | default(value="") %} +{% set self_hosted_url = config.extra.analytics.self_hosted_url | default(value="") %} + +{% if analytics_service == "goatcounter" %} +{# Prevent non-demo sites from using the demo analytics account #} +{% if self_hosted_url == "https://tabi-stats.osc.garden" and config.base_url == "https://welpo.github.io/tabi" or +self_hosted_url != "https://tabi-stats.osc.garden" %} + +{% endif %} + +{% elif analytics_service == "umami" %} + + +{% elif analytics_service == "plausible" %} + + +{% endif %} -- 2.46.1