Add hugo.IsExtended
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 9 Apr 2021 05:28:27 +0000 (07:28 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 9 Apr 2021 05:28:27 +0000 (07:28 +0200)
Fixes #8399

common/hugo/hugo.go
common/hugo/hugo_test.go
docs/content/en/functions/hugo.md

index 67e8e40a6d0f29617f4a6965ab5dd8fc52ad170d..1aae807769fe9d6cd329c1359e87d8f46faf734f 100644 (file)
@@ -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 == "" {
index 0862f36e751979e41d6c9bee95a386998cb972a8..0631be62c063814b3b03b72cdc05541331b02258 100644 (file)
@@ -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)
index 099a5fa96c34b81dd5212a6e275cd044833d939e..78f5018c406097dbbce8325503ececfc6da52ef7 100644 (file)
@@ -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