Skip to content

Commit

Permalink
feat: add the analyze page parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Oct 12, 2024
1 parent f80c1a4 commit 9dcf9aa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

[params.hugopress.modules.microsoft-clarity.hooks.head-end]
cacheable = true
cache_param_key = "analyze"
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{ partial "microsoft-clarity/index" . }}
{{ partialCached "microsoft-clarity/index" .Page .Page.Params.analyze }}
18 changes: 10 additions & 8 deletions layouts/partials/microsoft-clarity/index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{{- with site.Params.microsoft_clarity.id }}
<script type="text/javascript">
(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "{{ . }}");
</script>
{{- if default true .Params.analyze }}
{{- with site.Params.microsoft_clarity.id }}
<script type="text/javascript">
(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "{{ . }}");
</script>
{{- end }}
{{- end }}

0 comments on commit 9dcf9aa

Please sign in to comment.