mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Don't use self-closing generator tag
This commit is contained in:
parent
a066e98851
commit
01ebb6e304
4 changed files with 7 additions and 7 deletions
|
@ -68,7 +68,7 @@ func (i Info) Version() VersionString {
|
||||||
|
|
||||||
// Generator a Hugo meta generator HTML tag.
|
// Generator a Hugo meta generator HTML tag.
|
||||||
func (i Info) Generator() template.HTML {
|
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 {
|
func (i Info) IsProduction() bool {
|
||||||
|
|
|
@ -22,7 +22,7 @@ aliases: []
|
||||||
`hugo` returns an instance that contains the following functions:
|
`hugo` returns an instance that contains the following functions:
|
||||||
|
|
||||||
hugo.Generator
|
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
|
hugo.Version
|
||||||
: the current version of the Hugo binary you are using e.g. `0.63.2`
|
: the current version of the Hugo binary you are using e.g. `0.63.2`
|
||||||
|
|
|
@ -25,7 +25,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
metaTagsCheck = regexp.MustCompile(`(?i)<meta\s+name=['|"]?generator['|"]?`)
|
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.
|
// HugoGenerator injects a meta generator tag for Hugo if none present.
|
||||||
|
|
|
@ -39,10 +39,10 @@ func TestHugoGeneratorInject(t *testing.T) {
|
||||||
META
|
META
|
||||||
<foo />
|
<foo />
|
||||||
</HEAD>`},
|
</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>"},
|
||||||
{"<head>", "<head>\n\tMETA"},
|
{"<head>", "<head>\n\tMETA"},
|
||||||
|
|
Loading…
Reference in a new issue