mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-28 22:11:48 -05:00
Add hugo.IsMultiHost
This commit is contained in:
parent
ada3fceea8
commit
1f48b717c7
4 changed files with 29 additions and 0 deletions
|
@ -111,11 +111,17 @@ func (i HugoInfo) Deps() []*Dependency {
|
||||||
return i.deps
|
return i.deps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsMultiHost reports whether each configured language has a unique baseURL.
|
||||||
|
func (i HugoInfo) IsMultiHost() bool {
|
||||||
|
return i.conf.IsMultihost()
|
||||||
|
}
|
||||||
|
|
||||||
// ConfigProvider represents the config options that are relevant for HugoInfo.
|
// ConfigProvider represents the config options that are relevant for HugoInfo.
|
||||||
type ConfigProvider interface {
|
type ConfigProvider interface {
|
||||||
Environment() string
|
Environment() string
|
||||||
Running() bool
|
Running() bool
|
||||||
WorkingDir() string
|
WorkingDir() string
|
||||||
|
IsMultihost() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewInfo creates a new Hugo Info object.
|
// NewInfo creates a new Hugo Info object.
|
||||||
|
|
|
@ -68,6 +68,7 @@ type testConfig struct {
|
||||||
environment string
|
environment string
|
||||||
running bool
|
running bool
|
||||||
workingDir string
|
workingDir string
|
||||||
|
multihost bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c testConfig) Environment() string {
|
func (c testConfig) Environment() string {
|
||||||
|
@ -81,3 +82,7 @@ func (c testConfig) Running() bool {
|
||||||
func (c testConfig) WorkingDir() string {
|
func (c testConfig) WorkingDir() string {
|
||||||
return c.workingDir
|
return c.workingDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c testConfig) IsMultihost() bool {
|
||||||
|
return c.multihost
|
||||||
|
}
|
||||||
|
|
|
@ -160,6 +160,7 @@ type testConfig struct {
|
||||||
environment string
|
environment string
|
||||||
running bool
|
running bool
|
||||||
workingDir string
|
workingDir string
|
||||||
|
multihost bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c testConfig) Environment() string {
|
func (c testConfig) Environment() string {
|
||||||
|
@ -174,6 +175,10 @@ func (c testConfig) WorkingDir() string {
|
||||||
return c.workingDir
|
return c.workingDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c testConfig) IsMultihost() bool {
|
||||||
|
return c.multihost
|
||||||
|
}
|
||||||
|
|
||||||
func TestIsGlobWithExtension(t *testing.T) {
|
func TestIsGlobWithExtension(t *testing.T) {
|
||||||
c := qt.New(t)
|
c := qt.New(t)
|
||||||
|
|
||||||
|
|
13
testscripts/commands/hugo_is_multihost.txt
Normal file
13
testscripts/commands/hugo_is_multihost.txt
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
hugo
|
||||||
|
|
||||||
|
stdout 'IsMultiHost: true'
|
||||||
|
|
||||||
|
-- hugo.toml --
|
||||||
|
title = "Hugo IsMultiHost Test"
|
||||||
|
[languages.en]
|
||||||
|
baseURL = "https://example.org"
|
||||||
|
[languages.zh]
|
||||||
|
baseURL = "https://zh.example.org"
|
||||||
|
|
||||||
|
-- layouts/index.html --
|
||||||
|
{{ warnf "IsMultiHost: %v" hugo.IsMultiHost }}
|
Loading…
Reference in a new issue