From 56ca6bbfc7e10c7e93ab5cb15486da32b4726d87 Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Tue, 8 Oct 2024 14:57:21 -0400 Subject: [PATCH] Add plausible analytics template and configuration Co-authored-by: Laure Thompson <602628+laurejt@users.noreply.github.com> --- config/_default/config.yaml | 5 +++++ themes/startwords/layouts/_default/baseof.html | 1 + .../startwords/layouts/partials/plausible_analytics.html | 7 +++++++ 3 files changed, 13 insertions(+) create mode 100644 themes/startwords/layouts/partials/plausible_analytics.html diff --git a/config/_default/config.yaml b/config/_default/config.yaml index 5942a59ca..eb1b9fe3f 100644 --- a/config/_default/config.yaml +++ b/config/_default/config.yaml @@ -60,6 +60,11 @@ params: ISSN: 2694-2658 googleSiteVerification: pS2kpksxg6JeC90IvA8BHVsFuK_6b7J_vARVLqqu7ck absoluteArticleLinks: false + plausible: + domain: startwords.cdh.princeton.edu + script: https://plausible.io/js/script.file-downloads.hash.outbound-links.js + notfound: true + defaultContentLang: en diff --git a/themes/startwords/layouts/_default/baseof.html b/themes/startwords/layouts/_default/baseof.html index 44482421d..3d3e83726 100644 --- a/themes/startwords/layouts/_default/baseof.html +++ b/themes/startwords/layouts/_default/baseof.html @@ -73,6 +73,7 @@ {{- if hugo.IsProduction -}} {{ partial "partials/google_analytics.html" . }} + {{ partial "partials/plausible_analytics.html" . }} {{- end -}} {{- if or (.HasShortcode "deepzoom") (isset .Page.Params "needs_deepzoom") }}{{/* include openseadragon when deepzoom shortcode is used or requested in page params */}} diff --git a/themes/startwords/layouts/partials/plausible_analytics.html b/themes/startwords/layouts/partials/plausible_analytics.html new file mode 100644 index 000000000..32e60dc0c --- /dev/null +++ b/themes/startwords/layouts/partials/plausible_analytics.html @@ -0,0 +1,7 @@ +{{- if isset site.Params "plausible" }} +{{/* plausible analytics */}} + +{{- if isset site.Params.plausible "notfound" }} + +{{- end }} +{{- end }} \ No newline at end of file