From 9dcf9aa933003320aabed39c47ab97b3f4a22629 Mon Sep 17 00:00:00 2001 From: razonyang Date: Sat, 12 Oct 2024 11:01:06 +0800 Subject: [PATCH] feat: add the `analyze` page parameter --- hugo.toml | 1 + .../microsoft-clarity/hooks/head-end.html | 2 +- layouts/partials/microsoft-clarity/index.html | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/hugo.toml b/hugo.toml index a4c9b9f..e946339 100644 --- a/hugo.toml +++ b/hugo.toml @@ -3,3 +3,4 @@ [params.hugopress.modules.microsoft-clarity.hooks.head-end] cacheable = true +cache_param_key = "analyze" diff --git a/layouts/partials/hugopress/modules/microsoft-clarity/hooks/head-end.html b/layouts/partials/hugopress/modules/microsoft-clarity/hooks/head-end.html index b2b2754..85ebfb1 100644 --- a/layouts/partials/hugopress/modules/microsoft-clarity/hooks/head-end.html +++ b/layouts/partials/hugopress/modules/microsoft-clarity/hooks/head-end.html @@ -1 +1 @@ -{{ partial "microsoft-clarity/index" . }} +{{ partialCached "microsoft-clarity/index" .Page .Page.Params.analyze }} diff --git a/layouts/partials/microsoft-clarity/index.html b/layouts/partials/microsoft-clarity/index.html index 7488347..6e7b519 100644 --- a/layouts/partials/microsoft-clarity/index.html +++ b/layouts/partials/microsoft-clarity/index.html @@ -1,9 +1,11 @@ -{{- with site.Params.microsoft_clarity.id }} - +{{- if default true .Params.analyze }} + {{- with site.Params.microsoft_clarity.id }} + + {{- end }} {{- end }}