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" readTimeSeparator = "CHANGE ME READ TIME"
# legacyLayout = false # legacyLayout = false
shareSocial = true shareSocial = true
# googleTagManager = "GTM-XXXXXXXX"
[[params.socialLinks]] [[params.socialLinks]]
name = "mastodon" name = "mastodon"

View file

@ -1,6 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{.Site.LanguageCode}}"> <html lang="{{.Site.LanguageCode}}">
<head> <head>
{{- if .Site.Params.googleTagManager -}}{{- partial "googleTagManager_head.html" . -}}{{- end -}}
{{- partial "analytics.html" . -}} {{- partial "analytics.html" . -}}
{{- partial "site-meta.html" -}} {{- partial "site-meta.html" -}}
{{ $author := (.Params.author | default .Site.Params.author.name) -}} {{ $author := (.Params.author | default .Site.Params.author.name) -}}
@ -25,29 +26,30 @@
{{- block "head" . -}}{{- end -}} {{- block "head" . -}}{{- end -}}
{{- if templates.Exists "partials/extra-head.html" -}}{{- partial "extra-head.html" . -}}{{- end -}}</head> {{- if templates.Exists "partials/extra-head.html" -}}{{- partial "extra-head.html" . -}}{{- end -}}</head>
<body id="page"> <body id="page">
{{- block "header" . -}}{{ end -}} {{- if .Site.Params.googleTagManager -}}{{- partial "googleTagManager_body.html" . -}}{{- end -}}
{{- block "main" . -}}{{ end -}} {{- block "header" . -}}{{ end -}}
{{- block "footer" . -}}{{ end }} {{- block "main" . -}}{{ end -}}
{{- partial "scroll-to-top.html" . }} {{- block "footer" . -}}{{ end }}
{{- $main := resources.Get "js/main.js" -}} {{- partial "scroll-to-top.html" . }}
{{- if .Site.Params.code_copy_button | default true -}} {{- $main := resources.Get "js/main.js" -}}
{{- if .Site.Params.code_copy_button | default true -}}
{{ $codeCopy := resources.Get "js/code-copy.js" -}} {{ $codeCopy := resources.Get "js/code-copy.js" -}}
{{ $script := slice $main $codeCopy | resources.Concat "js/bundle.js" | minify | fingerprint -}} {{ $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> <script async src="{{ $script.Permalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script>
{{- else -}} {{- else -}}
{{ $script := $main | minify | fingerprint -}} {{ $script := $main | minify | fingerprint -}}
<script async src="{{ $script.Permalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script> <script async src="{{ $script.Permalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script>
{{- end -}} {{- end -}}
{{- if and (not (eq .Site.Params.shareSocial nil)) (.Site.Params.shareSocial) -}} {{- if and (not (eq .Site.Params.shareSocial nil)) (.Site.Params.shareSocial) -}}
{{ $linkshare := resources.Get "js/link-share.js" | minify | fingerprint -}} {{ $linkshare := resources.Get "js/link-share.js" | minify | fingerprint -}}
<script async src="{{ $linkshare.Permalink }}" {{ printf "integrity=%q" $linkshare.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script> <script async src="{{ $linkshare.Permalink }}" {{ printf "integrity=%q" $linkshare.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script>
{{- end -}} {{- end -}}
{{- range .Params.custom_js -}} {{- range .Params.custom_js -}}
{{ $c_js := resources.Get . | minify | fingerprint -}} {{ $c_js := resources.Get . | minify | fingerprint -}}
<script defer src="{{ $c_js.Permalink }}" {{ printf "integrity=%q" $c_js.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script> <script defer src="{{ $c_js.Permalink }}" {{ printf "integrity=%q" $c_js.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script>
{{- end }} {{- end }}
{{- partial "mathjax.html" . -}} {{- partial "mathjax.html" . -}}
{{- if templates.Exists "partials/extra-foot.html" -}}{{- partial "extra-foot.html" . -}}{{- end }} {{- if templates.Exists "partials/extra-foot.html" -}}{{- partial "extra-foot.html" . -}}{{- end }}
</body> </body>
</html> </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>