]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
Don't use self-closing generator tag
authorJB <djibe89@hotmail.com>
Fri, 14 Oct 2022 10:16:53 +0000 (12:16 +0200)
committerGitHub <noreply@github.com>
Fri, 14 Oct 2022 10:16:53 +0000 (12:16 +0200)
common/hugo/hugo.go
docs/content/en/functions/hugo.md
transform/metainject/hugogenerator.go
transform/metainject/hugogenerator_test.go

index 54fbd65a3650fb97ab190307b18272085d7ab1dc..5f51d2be24daa774f2f64c6b38253679f17f5224 100644 (file)
@@ -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(`<meta name="generator" content="Hugo %s" />`, CurrentVersion.String()))
+       return template.HTML(fmt.Sprintf(`<meta name="generator" content="Hugo %s">`, CurrentVersion.String()))
 }
 
 func (i Info) IsProduction() bool {
index 1792f5a8d764827d02517cb7866b76863cba1b14..40a0036296853b05932fd3a5a294312ed4541df3 100644 (file)
@@ -22,7 +22,7 @@ aliases: []
 `hugo` returns an instance that contains the following functions:
 
 hugo.Generator
-: `<meta>` tag for the version of Hugo that generated the site. `hugo.Generator` outputs a *complete* HTML tag; e.g. `<meta name="generator" content="Hugo 0.63.2" />`
+: `<meta>` tag for the version of Hugo that generated the site. `hugo.Generator` outputs a *complete* HTML tag; e.g. `<meta name="generator" content="Hugo 0.63.2">`
 
 hugo.Version
 : the current version of the Hugo binary you are using e.g. `0.63.2`
index 20f05145b1caff7732a4a06761b18ec6aaef8800..fd3a6a4abaf7035c3fc3e8527e6414c6bccba2a6 100644 (file)
@@ -25,7 +25,7 @@ import (
 
 var (
        metaTagsCheck    = regexp.MustCompile(`(?i)<meta\s+name=['|"]?generator['|"]?`)
-       hugoGeneratorTag = fmt.Sprintf(`<meta name="generator" content="Hugo %s" />`, hugo.CurrentVersion)
+       hugoGeneratorTag = fmt.Sprintf(`<meta name="generator" content="Hugo %s">`, hugo.CurrentVersion)
 )
 
 // HugoGenerator injects a meta generator tag for Hugo if none present.
index 1d6d7c4b9ff95e2cf124a22448306dfc3b61a0c4..415da61b3aabb4cb0d188ae06d51118d30bf3955 100644 (file)
@@ -39,10 +39,10 @@ func TestHugoGeneratorInject(t *testing.T) {
        META
        <foo />
 </HEAD>`},
-               {`<head><meta name="generator" content="Jekyll" /></head>`, `<head><meta name="generator" content="Jekyll" /></head>`},
-               {`<head><meta name='generator' content='Jekyll' /></head>`, `<head><meta name='generator' content='Jekyll' /></head>`},
-               {`<head><meta name=generator content=Jekyll /></head>`, `<head><meta name=generator content=Jekyll /></head>`},
-               {`<head><META     NAME="GENERATOR" content="Jekyll" /></head>`, `<head><META     NAME="GENERATOR" content="Jekyll" /></head>`},
+               {`<head><meta name="generator" content="Jekyll"></head>`, `<head><meta name="generator" content="Jekyll"></head>`},
+               {`<head><meta name='generator' content='Jekyll'></head>`, `<head><meta name='generator' content='Jekyll'></head>`},
+               {`<head><meta name=generator content=Jekyll></head>`, `<head><meta name=generator content=Jekyll></head>`},
+               {`<head><META     NAME="GENERATOR" content="Jekyll"></head>`, `<head><META     NAME="GENERATOR" content="Jekyll"></head>`},
                {"", ""},
                {"</head>", "</head>"},
                {"<head>", "<head>\n\tMETA"},