From ba415158c7aa93b2b28aad790af870f93b47fb14 Mon Sep 17 00:00:00 2001 From: Vittorio Alfieri Date: Sun, 15 Mar 2026 00:12:19 -0500 Subject: [PATCH] Add config-driven tracking partials: GTM, Meta Pixel, Facebook verification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New partials driven by site params: - gtm_id: Google Tag Manager (head script + body noscript) - meta_pixel_id: Meta/Facebook Pixel - facebook_domain_verification: Facebook domain verification meta tag All are optional — if the param is not set, nothing is rendered. GTM body noscript is injected in all 5 layout files after . Co-Authored-By: Claude Opus 4.6 --- exampleSite/hugo.toml | 5 +++++ layouts/404.html | 2 ++ layouts/_default/list.html | 2 ++ layouts/_default/single.html | 2 ++ layouts/index.html | 2 ++ layouts/page/single.html | 2 ++ layouts/partials/facebook-verification.html | 3 +++ layouts/partials/gtm-body.html | 6 ++++++ layouts/partials/gtm-head.html | 12 ++++++++++++ layouts/partials/headers.html | 5 +++++ layouts/partials/meta-pixel-head.html | 21 +++++++++++++++++++++ 11 files changed, 62 insertions(+) create mode 100644 layouts/partials/facebook-verification.html create mode 100644 layouts/partials/gtm-body.html create mode 100644 layouts/partials/gtm-head.html create mode 100644 layouts/partials/meta-pixel-head.html diff --git a/exampleSite/hugo.toml b/exampleSite/hugo.toml index b07cb9f80..7be9dbee6 100644 --- a/exampleSite/hugo.toml +++ b/exampleSite/hugo.toml @@ -408,6 +408,11 @@ pluralizelisttitles = false latitude = "-12.043333" longitude = "-77.028333" + # Tracking & Verification (optional) + # facebook_domain_verification = "your-verification-code" + # meta_pixel_id = "your-meta-pixel-id" + # gtm_id = "GTM-XXXXXXX" + # Style options: default (light-blue), blue, green, marsala, pink, red, turquoise, violet style = "default" diff --git a/layouts/404.html b/layouts/404.html index 9e01ae1fe..2eb00c072 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -8,6 +8,8 @@ + {{ partial "gtm-body.html" . }} +
{{ partial "top.html" . }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 1063747ea..22a377f58 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -8,6 +8,8 @@ + {{ partial "gtm-body.html" . }} +
{{ partial "top.html" . }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 269e038fe..6531cb4f2 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -8,6 +8,8 @@ + {{ partial "gtm-body.html" . }} +
{{ partial "top.html" . }} diff --git a/layouts/index.html b/layouts/index.html index 96209d460..763773990 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -8,6 +8,8 @@ + {{ partial "gtm-body.html" . }} +
{{ partial "top.html" . }} diff --git a/layouts/page/single.html b/layouts/page/single.html index 09f3fefed..9e58663c1 100644 --- a/layouts/page/single.html +++ b/layouts/page/single.html @@ -8,6 +8,8 @@ + {{ partial "gtm-body.html" . }} +
{{ partial "top.html" . }} diff --git a/layouts/partials/facebook-verification.html b/layouts/partials/facebook-verification.html new file mode 100644 index 000000000..c1335fa23 --- /dev/null +++ b/layouts/partials/facebook-verification.html @@ -0,0 +1,3 @@ +{{- with .Site.Params.facebook_domain_verification -}} + +{{- end -}} diff --git a/layouts/partials/gtm-body.html b/layouts/partials/gtm-body.html new file mode 100644 index 000000000..fafdba551 --- /dev/null +++ b/layouts/partials/gtm-body.html @@ -0,0 +1,6 @@ +{{- with .Site.Params.gtm_id -}} + + + +{{- end -}} diff --git a/layouts/partials/gtm-head.html b/layouts/partials/gtm-head.html new file mode 100644 index 000000000..d961fac48 --- /dev/null +++ b/layouts/partials/gtm-head.html @@ -0,0 +1,12 @@ +{{- with .Site.Params.gtm_id -}} + + + +{{- end -}} diff --git a/layouts/partials/headers.html b/layouts/partials/headers.html index a517e57f9..da65205de 100644 --- a/layouts/partials/headers.html +++ b/layouts/partials/headers.html @@ -98,3 +98,8 @@ {{ end }} {{ with .Param "twitter_author" }}{{ end }} + + +{{ partial "facebook-verification.html" . }} +{{ partial "meta-pixel-head.html" . }} +{{ partial "gtm-head.html" . }} diff --git a/layouts/partials/meta-pixel-head.html b/layouts/partials/meta-pixel-head.html new file mode 100644 index 000000000..095571a79 --- /dev/null +++ b/layouts/partials/meta-pixel-head.html @@ -0,0 +1,21 @@ +{{- with .Site.Params.meta_pixel_id -}} + + + + +{{- end -}}