diff options
-rw-r--r-- | hugolib/paths/paths.go | 6 | ||||
-rw-r--r-- | hugolib/resource_chain_test.go | 17 |
2 files changed, 19 insertions, 4 deletions
diff --git a/hugolib/paths/paths.go b/hugolib/paths/paths.go index 10acf0cb3..625d68ec6 100644 --- a/hugolib/paths/paths.go +++ b/hugolib/paths/paths.go @@ -139,10 +139,8 @@ func New(fs *hugofs.Fs, cfg config.Provider) (*Paths, error) { absResourcesDir = FilePathSeparator } - multilingual := cfg.GetBool("multilingual") - var multihostTargetBasePaths []string - if multilingual { + if languages.IsMultihost() { for _, l := range languages { multihostTargetBasePaths = append(multihostTargetBasePaths, l.Lang) } @@ -167,7 +165,7 @@ func New(fs *hugofs.Fs, cfg config.Provider) (*Paths, error) { themes: config.GetStringSlicePreserveString(cfg, "theme"), - multilingual: multilingual, + multilingual: cfg.GetBool("multilingual"), defaultContentLanguageInSubdir: cfg.GetBool("defaultContentLanguageInSubdir"), DefaultContentLanguage: defaultContentLanguage, diff --git a/hugolib/resource_chain_test.go b/hugolib/resource_chain_test.go index 0a4c3bd1f..ad0d9611c 100644 --- a/hugolib/resource_chain_test.go +++ b/hugolib/resource_chain_test.go @@ -385,3 +385,20 @@ $color: #333; test.verify(b) } } + +func TestMultiSiteResource(t *testing.T) { + t.Parallel() + assert := require.New(t) + + b := newMultiSiteTestDefaultBuilder(t) + + b.CreateSites().Build(BuildCfg{}) + + // This build is multilingual, but not multihost. There should be only one pipes.txt + b.AssertFileContent("public/fr/index.html", "French Home Page", "String Resource: /blog/text/pipes.txt") + assert.False(b.CheckExists("public/fr/text/pipes.txt")) + assert.False(b.CheckExists("public/en/text/pipes.txt")) + b.AssertFileContent("public/en/index.html", "Default Home Page", "String Resource: /blog/text/pipes.txt") + b.AssertFileContent("public/text/pipes.txt", "Hugo Pipes") + +} |