}
func TestNodesWithMenu(t *testing.T) {
- //jww.SetStdoutThreshold(jww.LevelDebug)
- //defer jww.SetStdoutThreshold(jww.LevelFatal)
testCommonResetState()
writeLayoutsForNodeAsPageTests(t)
}
+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) {
writeRegularPagesForNodeAsPageTestsWithLang(t, "")
}
}
// renderAliases renders shell pages that simply have a redirect in the header.
-// TODO(bep) np aliases of node types
func (s *Site) renderAliases() error {
- for _, p := range s.Pages {
+ for _, p := range s.Nodes {
if len(p.Aliases) == 0 {
continue
}