From ac03834fbb987b202eb5486187ee844bb370378e Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 28 Nov 2023 14:47:18 +0000 Subject: [PATCH] Hermit-V2 Theme Update --- hugo.toml.example | 3 +- layouts/_default/baseof.html | 48 +++++++++++---------- layouts/partials/googleTagManager_body.html | 1 + layouts/partials/googleTagManager_head.html | 1 + 4 files changed, 29 insertions(+), 24 deletions(-) create mode 100644 layouts/partials/googleTagManager_body.html create mode 100644 layouts/partials/googleTagManager_head.html diff --git a/hugo.toml.example b/hugo.toml.example index cfe3693..4a1db72 100644 --- a/hugo.toml.example +++ b/hugo.toml.example @@ -83,7 +83,8 @@ enableEmoji = true readTimeSeparator = "CHANGE ME READ TIME" # legacyLayout = false shareSocial = true - + # googleTagManager = "GTM-XXXXXXXX" + [[params.socialLinks]] name = "mastodon" url = "https://joinmastodon.org/" diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index d388fc7..88e18e3 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,6 +1,7 @@ +{{- if .Site.Params.googleTagManager -}}{{- partial "googleTagManager_head.html" . -}}{{- end -}} {{- partial "analytics.html" . -}} {{- partial "site-meta.html" -}} {{ $author := (.Params.author | default .Site.Params.author.name) -}} @@ -25,29 +26,30 @@ {{- block "head" . -}}{{- end -}} {{- if templates.Exists "partials/extra-head.html" -}}{{- partial "extra-head.html" . -}}{{- end -}} - {{- block "header" . -}}{{ end -}} - {{- block "main" . -}}{{ end -}} - {{- block "footer" . -}}{{ end }} - {{- partial "scroll-to-top.html" . }} - {{- $main := resources.Get "js/main.js" -}} - {{- if .Site.Params.code_copy_button | default true -}} - {{ $codeCopy := resources.Get "js/code-copy.js" -}} - {{ $script := slice $main $codeCopy | resources.Concat "js/bundle.js" | minify | fingerprint -}} - - {{- else -}} - {{ $script := $main | minify | fingerprint -}} - - {{- end -}} - {{- if and (not (eq .Site.Params.shareSocial nil)) (.Site.Params.shareSocial) -}} - {{ $linkshare := resources.Get "js/link-share.js" | minify | fingerprint -}} - - {{- end -}} - {{- range .Params.custom_js -}} - {{ $c_js := resources.Get . | minify | fingerprint -}} - - {{- end }} - {{- partial "mathjax.html" . -}} - {{- if templates.Exists "partials/extra-foot.html" -}}{{- partial "extra-foot.html" . -}}{{- end }} +{{- if .Site.Params.googleTagManager -}}{{- partial "googleTagManager_body.html" . -}}{{- end -}} +{{- block "header" . -}}{{ end -}} +{{- block "main" . -}}{{ end -}} +{{- block "footer" . -}}{{ end }} +{{- partial "scroll-to-top.html" . }} +{{- $main := resources.Get "js/main.js" -}} +{{- if .Site.Params.code_copy_button | default true -}} + {{ $codeCopy := resources.Get "js/code-copy.js" -}} + {{ $script := slice $main $codeCopy | resources.Concat "js/bundle.js" | minify | fingerprint -}} + +{{- else -}} + {{ $script := $main | minify | fingerprint -}} + +{{- end -}} +{{- if and (not (eq .Site.Params.shareSocial nil)) (.Site.Params.shareSocial) -}} +{{ $linkshare := resources.Get "js/link-share.js" | minify | fingerprint -}} + +{{- end -}} +{{- range .Params.custom_js -}} +{{ $c_js := resources.Get . | minify | fingerprint -}} + +{{- end }} +{{- partial "mathjax.html" . -}} +{{- if templates.Exists "partials/extra-foot.html" -}}{{- partial "extra-foot.html" . -}}{{- end }} diff --git a/layouts/partials/googleTagManager_body.html b/layouts/partials/googleTagManager_body.html new file mode 100644 index 0000000..0031b45 --- /dev/null +++ b/layouts/partials/googleTagManager_body.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/layouts/partials/googleTagManager_head.html b/layouts/partials/googleTagManager_head.html new file mode 100644 index 0000000..8648b01 --- /dev/null +++ b/layouts/partials/googleTagManager_head.html @@ -0,0 +1 @@ + \ No newline at end of file