Hermit-V2 Theme Update

This commit is contained in:
GitHub Action 2023-11-28 14:47:18 +00:00
parent d815aab4db
commit ac03834fbb
4 changed files with 29 additions and 24 deletions

View file

@ -83,6 +83,7 @@ enableEmoji = true
readTimeSeparator = "CHANGE ME READ TIME"
# legacyLayout = false
shareSocial = true
# googleTagManager = "GTM-XXXXXXXX"
[[params.socialLinks]]
name = "mastodon"

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html lang="{{.Site.LanguageCode}}">
<head>
{{- 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 -}}</head>
<body id="page">
{{- 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 -}}
{{- 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 -}}
<script async src="{{ $script.Permalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script>
{{- else -}}
{{- else -}}
{{ $script := $main | minify | fingerprint -}}
<script async src="{{ $script.Permalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script>
{{- end -}}
{{- if and (not (eq .Site.Params.shareSocial nil)) (.Site.Params.shareSocial) -}}
{{ $linkshare := resources.Get "js/link-share.js" | minify | fingerprint -}}
<script async src="{{ $linkshare.Permalink }}" {{ printf "integrity=%q" $linkshare.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script>
{{- end -}}
{{- range .Params.custom_js -}}
{{ $c_js := resources.Get . | minify | fingerprint -}}
<script defer src="{{ $c_js.Permalink }}" {{ printf "integrity=%q" $c_js.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script>
{{- end }}
{{- partial "mathjax.html" . -}}
{{- if templates.Exists "partials/extra-foot.html" -}}{{- partial "extra-foot.html" . -}}{{- end }}
{{- end -}}
{{- if and (not (eq .Site.Params.shareSocial nil)) (.Site.Params.shareSocial) -}}
{{ $linkshare := resources.Get "js/link-share.js" | minify | fingerprint -}}
<script async src="{{ $linkshare.Permalink }}" {{ printf "integrity=%q" $linkshare.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script>
{{- end -}}
{{- range .Params.custom_js -}}
{{ $c_js := resources.Get . | minify | fingerprint -}}
<script defer src="{{ $c_js.Permalink }}" {{ printf "integrity=%q" $c_js.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script>
{{- end }}
{{- partial "mathjax.html" . -}}
{{- if templates.Exists "partials/extra-foot.html" -}}{{- partial "extra-foot.html" . -}}{{- end }}
</body>
</html>

View file

@ -0,0 +1 @@
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ .Site.Params.googleTagManager }}" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

View file

@ -0,0 +1 @@
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','{{ .Site.Params.googleTagManager }}');</script>