From: Bjørn Erik Pedersen Date: Fri, 9 Apr 2021 05:28:27 +0000 (+0200) Subject: Add hugo.IsExtended X-Git-Tag: v0.83.0~58 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7fdd2b95e20f322b0a47f63ff1010a04f47ce67b;p=brevno-suite%2Fhugo Add hugo.IsExtended Fixes #8399 --- diff --git a/common/hugo/hugo.go b/common/hugo/hugo.go index 67e8e40a..1aae8077 100644 --- a/common/hugo/hugo.go +++ b/common/hugo/hugo.go @@ -71,6 +71,10 @@ func (i Info) IsProduction() bool { return i.Environment == EnvironmentProduction } +func (i Info) IsExtended() bool { + return IsExtended +} + // NewInfo creates a new Hugo Info object. func NewInfo(environment string) Info { if environment == "" { diff --git a/common/hugo/hugo_test.go b/common/hugo/hugo_test.go index 0862f36e..0631be62 100644 --- a/common/hugo/hugo_test.go +++ b/common/hugo/hugo_test.go @@ -32,6 +32,7 @@ func TestHugoInfo(t *testing.T) { c.Assert(hugoInfo.Environment, qt.Equals, "production") c.Assert(string(hugoInfo.Generator()), qt.Contains, fmt.Sprintf("Hugo %s", hugoInfo.Version())) c.Assert(hugoInfo.IsProduction(), qt.Equals, true) + c.Assert(hugoInfo.IsExtended(), qt.Equals, IsExtended) devHugoInfo := NewInfo("development") c.Assert(devHugoInfo.IsProduction(), qt.Equals, false) diff --git a/docs/content/en/functions/hugo.md b/docs/content/en/functions/hugo.md index 099a5fa9..78f5018c 100644 --- a/docs/content/en/functions/hugo.md +++ b/docs/content/en/functions/hugo.md @@ -41,6 +41,9 @@ hugo.CommitHash hugo.BuildDate : the compile date of the current Hugo binary formatted with RFC 3339 e.g. `2002-10-02T10:00:00-05:00` +hugo.IsExtended {{< new-in "0.83.0" >}} +: whether this is the extended Hugo binary. + hugo.IsProduction : returns true if `hugo.Environment` is set to the production environment