common/hugo: Add hugo.IsServer and hugo.IsDevelopment

And deprecate site.IsServer.

Closes #11510
This commit is contained in:
Joe Mooring
2023-09-29 10:23:08 -07:00
committed by Bjørn Erik Pedersen
parent 274852bcf2
commit d1b4458536
7 changed files with 41 additions and 6 deletions

View File

@@ -159,6 +159,7 @@ func TestDecodeCascadeConfig(t *testing.T) {
type testConfig struct {
environment string
running bool
workingDir string
}
@@ -166,6 +167,10 @@ func (c testConfig) Environment() string {
return c.environment
}
func (c testConfig) Running() bool {
return c.running
}
func (c testConfig) WorkingDir() string {
return c.workingDir
}

View File

@@ -56,6 +56,7 @@ type Site interface {
Home() Page
// Returns true if we're running in a server.
// Deprecated: use hugo.IsServer instead
IsServer() bool
// Returns the server port.
@@ -211,6 +212,7 @@ func (s *siteWrapper) Home() Page {
return s.s.Home()
}
// Deprecated: use hugo.IsServer instead
func (s *siteWrapper) IsServer() bool {
return s.s.IsServer()
}
@@ -383,6 +385,7 @@ func (t testSite) GetIdentity() identity.Identity {
return identity.KeyValueIdentity{Key: "site", Value: t.l.Lang}
}
// Deprecated: use hugo.IsServer instead
func (t testSite) IsServer() bool {
return false
}