theme: make creation of generator meta tag configurable #383

This commit is contained in:
Sören Weber 2022-11-13 12:16:34 +01:00
parent d2d7d808a0
commit 55822e8741
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
2 changed files with 8 additions and 4 deletions

View file

@ -36,6 +36,8 @@ Note that some of these parameters are explained in details in other sections of
# Javascript and CSS cache are automatically busted when new version of site is generated. # Javascript and CSS cache are automatically busted when new version of site is generated.
# Set this to true to disable this behavior (some proxies don't handle well this optimization) # Set this to true to disable this behavior (some proxies don't handle well this optimization)
disableAssetsBusting = false disableAssetsBusting = false
# Set this to true if you want to disable generation for generator version meta tags of hugo and the theme
disableGeneratorVersion = false
# Set this to true to disable copy-to-clipboard button for inline code. # Set this to true to disable copy-to-clipboard button for inline code.
disableInlineCopyToClipBoard = false disableInlineCopyToClipBoard = false
# A title for shortcuts in menu is set by default. Set this to true to disable it. # A title for shortcuts in menu is set by default. Set this to true to disable it.

View file

@ -2,12 +2,14 @@
<meta charset="utf-8"> <meta charset="utf-8">
{{- $c:=""}}{{/* to avoid that user swiping to the left leaves a gap on the right side, we set minimum-scale, even if not advised to */}} {{- $c:=""}}{{/* to avoid that user swiping to the left leaves a gap on the right side, we set minimum-scale, even if not advised to */}}
<meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0, minimum-scale=1.0"> <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0, minimum-scale=1.0">
{{- $gen := hugo.Generator }} {{- if (ne .Site.Params.disableGeneratorVersion true) }}
{{- $gen = replaceRE "\\s*/>$" ">" $gen }} {{- $gen := hugo.Generator }}
{{- $gen = replaceRE "\\s*/>$" ">" $gen }}
{{ $gen | safeHTML }} {{ $gen | safeHTML }}
{{- $ver := partial "version.txt" }} {{- $ver := partial "version.txt" }}
{{- $ver := printf "<meta name=\"generator\" content=\"%s %s\">" "Relearn" $ver }} {{- $ver := printf "<meta name=\"generator\" content=\"%s %s\">" "Relearn" $ver }}
{{ $ver | safeHTML }} {{ $ver | safeHTML }}
{{- end }}
{{- if not (and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) ) }} {{- if not (and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) ) }}
<meta name="robots" content="noindex, nofollow, noarchive, noimageindex"> <meta name="robots" content="noindex, nofollow, noarchive, noimageindex">
{{- end }} {{- end }}