Skip to content

Commit

Permalink
Don't use self-closing generator tag
Browse files Browse the repository at this point in the history
  • Loading branch information
djibe committed Oct 14, 2022
1 parent a066e98 commit 01ebb6e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion common/hugo/hugo.go
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/functions/hugo.md
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion transform/metainject/hugogenerator.go
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions transform/metainject/hugogenerator_test.go
Expand Up @@ -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"},
Expand Down

0 comments on commit 01ebb6e

Please sign in to comment.