mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
93717aac5c
commit
bbfebdea43
2 changed files with 13 additions and 8 deletions
|
@ -373,9 +373,12 @@ func (h *HugoSites) setupTranslations(master *Site) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pull over the collections from the master site
|
||||||
for i := 1; i < len(h.Sites); i++ {
|
for i := 1; i < len(h.Sites); i++ {
|
||||||
h.Sites[i].AllPages = h.Sites[0].AllPages
|
h.Sites[i].AllPages = h.Sites[0].AllPages
|
||||||
}
|
h.Sites[i].Data = h.Sites[0].Data
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(h.Sites) > 1 {
|
if len(h.Sites) > 1 {
|
||||||
|
|
|
@ -254,6 +254,10 @@ func doTestMultiSitesBuild(t *testing.T, configContent, configSuffix string) {
|
||||||
languageRedirect := readDestination(t, "public/index.html")
|
languageRedirect := readDestination(t, "public/index.html")
|
||||||
require.True(t, strings.Contains(languageRedirect, "0; url=http://example.com/blog/fr"), languageRedirect)
|
require.True(t, strings.Contains(languageRedirect, "0; url=http://example.com/blog/fr"), languageRedirect)
|
||||||
|
|
||||||
|
// check home page content (including data files rendering)
|
||||||
|
assertFileContent(t, "public/en/index.html", true, "Home Page 1", "Hello", "Hugo Rocks!")
|
||||||
|
assertFileContent(t, "public/fr/index.html", true, "Home Page 1", "Bonjour", "Hugo Rocks!")
|
||||||
|
|
||||||
// Check node translations
|
// Check node translations
|
||||||
homeEn := enSite.getNode("home-0")
|
homeEn := enSite.getNode("home-0")
|
||||||
require.NotNil(t, homeEn)
|
require.NotNil(t, homeEn)
|
||||||
|
@ -729,7 +733,7 @@ func createMultiTestSitesForConfig(t *testing.T, configContent, configSuffix str
|
||||||
|
|
||||||
if err := afero.WriteFile(hugofs.Source(),
|
if err := afero.WriteFile(hugofs.Source(),
|
||||||
filepath.Join("layouts", "index.html"),
|
filepath.Join("layouts", "index.html"),
|
||||||
[]byte("{{ $p := .Paginator }}Home Page {{ $p.PageNumber }}: {{ .Title }}|{{ .IsHome }}|{{ i18n \"hello\" }}|{{ .Permalink }}"),
|
[]byte("{{ $p := .Paginator }}Home Page {{ $p.PageNumber }}: {{ .Title }}|{{ .IsHome }}|{{ i18n \"hello\" }}|{{ .Permalink }}|{{ .Site.Data.hugo.slogan }}"),
|
||||||
0755); err != nil {
|
0755); err != nil {
|
||||||
t.Fatalf("Failed to write layout file: %s", err)
|
t.Fatalf("Failed to write layout file: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -885,11 +889,9 @@ lag:
|
||||||
t.Fatalf("Failed to write file: %s", err)
|
t.Fatalf("Failed to write file: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_, err := hugofs.Source().Open("content/other/doc5.fr.md")
|
|
||||||
|
|
||||||
if err != nil {
|
// Add some data
|
||||||
t.Fatalf("Unable to locate file")
|
writeSource(t, "data/hugo.toml", "slogan = \"Hugo Rocks!\"")
|
||||||
}
|
|
||||||
|
|
||||||
sites, err := NewHugoSitesFromConfiguration()
|
sites, err := NewHugoSitesFromConfiguration()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue