mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
7cb0e34dce
commit
2d91b17c04
2 changed files with 30 additions and 4 deletions
|
@ -325,8 +325,6 @@ categories: [
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNodesWithMenu(t *testing.T) {
|
func TestNodesWithMenu(t *testing.T) {
|
||||||
//jww.SetStdoutThreshold(jww.LevelDebug)
|
|
||||||
//defer jww.SetStdoutThreshold(jww.LevelFatal)
|
|
||||||
testCommonResetState()
|
testCommonResetState()
|
||||||
|
|
||||||
writeLayoutsForNodeAsPageTests(t)
|
writeLayoutsForNodeAsPageTests(t)
|
||||||
|
@ -353,6 +351,35 @@ menu:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNodesWithAlias(t *testing.T) {
|
||||||
|
//jww.SetStdoutThreshold(jww.LevelDebug)
|
||||||
|
//defer jww.SetStdoutThreshold(jww.LevelFatal)
|
||||||
|
testCommonResetState()
|
||||||
|
|
||||||
|
writeLayoutsForNodeAsPageTests(t)
|
||||||
|
writeRegularPagesForNodeAsPageTests(t)
|
||||||
|
|
||||||
|
writeSource(t, filepath.Join("content", "_index.md"), `---
|
||||||
|
title: Home With Alias
|
||||||
|
aliases:
|
||||||
|
- /my/new/home.html
|
||||||
|
---
|
||||||
|
`)
|
||||||
|
|
||||||
|
viper.Set("paginate", 1)
|
||||||
|
viper.Set("title", "Hugo Rocks!")
|
||||||
|
|
||||||
|
s := newSiteDefaultLang()
|
||||||
|
|
||||||
|
if err := buildAndRenderSite(s); err != nil {
|
||||||
|
t.Fatalf("Failed to build site: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
assertFileContent(t, filepath.Join("public", "index.html"), true, "Home With Alias")
|
||||||
|
assertFileContent(t, filepath.Join("public", "my", "new", "home.html"), true, "content=\"0; url=/")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func writeRegularPagesForNodeAsPageTests(t *testing.T) {
|
func writeRegularPagesForNodeAsPageTests(t *testing.T) {
|
||||||
writeRegularPagesForNodeAsPageTestsWithLang(t, "")
|
writeRegularPagesForNodeAsPageTestsWithLang(t, "")
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,9 +238,8 @@ func (s *Site) renderRobotsTXT() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// renderAliases renders shell pages that simply have a redirect in the header.
|
// renderAliases renders shell pages that simply have a redirect in the header.
|
||||||
// TODO(bep) np aliases of node types
|
|
||||||
func (s *Site) renderAliases() error {
|
func (s *Site) renderAliases() error {
|
||||||
for _, p := range s.Pages {
|
for _, p := range s.Nodes {
|
||||||
if len(p.Aliases) == 0 {
|
if len(p.Aliases) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue