From 01ebb6e304b243c335470f737cf7ad8b9d70bac9 Mon Sep 17 00:00:00 2001 From: JB Date: Fri, 14 Oct 2022 12:16:53 +0200 Subject: [PATCH] Don't use self-closing generator tag --- common/hugo/hugo.go | 2 +- docs/content/en/functions/hugo.md | 2 +- transform/metainject/hugogenerator.go | 2 +- transform/metainject/hugogenerator_test.go | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/hugo/hugo.go b/common/hugo/hugo.go index 54fbd65a365..5f51d2be24d 100644 --- a/common/hugo/hugo.go +++ b/common/hugo/hugo.go @@ -68,7 +68,7 @@ func (i Info) Version() VersionString { // Generator a Hugo meta generator HTML tag. func (i Info) Generator() template.HTML { - return template.HTML(fmt.Sprintf(``, CurrentVersion.String())) + return template.HTML(fmt.Sprintf(``, CurrentVersion.String())) } func (i Info) IsProduction() bool { diff --git a/docs/content/en/functions/hugo.md b/docs/content/en/functions/hugo.md index 1792f5a8d76..40a00362968 100644 --- a/docs/content/en/functions/hugo.md +++ b/docs/content/en/functions/hugo.md @@ -22,7 +22,7 @@ aliases: [] `hugo` returns an instance that contains the following functions: hugo.Generator -: `` tag for the version of Hugo that generated the site. `hugo.Generator` outputs a *complete* HTML tag; e.g. `` +: `` tag for the version of Hugo that generated the site. `hugo.Generator` outputs a *complete* HTML tag; e.g. `` hugo.Version : the current version of the Hugo binary you are using e.g. `0.63.2` diff --git a/transform/metainject/hugogenerator.go b/transform/metainject/hugogenerator.go index 20f05145b1c..fd3a6a4abaf 100644 --- a/transform/metainject/hugogenerator.go +++ b/transform/metainject/hugogenerator.go @@ -25,7 +25,7 @@ import ( var ( metaTagsCheck = regexp.MustCompile(`(?i)`, hugo.CurrentVersion) + hugoGeneratorTag = fmt.Sprintf(``, hugo.CurrentVersion) ) // HugoGenerator injects a meta generator tag for Hugo if none present. diff --git a/transform/metainject/hugogenerator_test.go b/transform/metainject/hugogenerator_test.go index 1d6d7c4b9ff..415da61b3aa 100644 --- a/transform/metainject/hugogenerator_test.go +++ b/transform/metainject/hugogenerator_test.go @@ -39,10 +39,10 @@ func TestHugoGeneratorInject(t *testing.T) { META `}, - {``, ``}, - {``, ``}, - {``, ``}, - {``, ``}, + {``, ``}, + {``, ``}, + {``, ``}, + {``, ``}, {"", ""}, {"", ""}, {"", "\n\tMETA"},