diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-10-31 10:23:01 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-11-22 09:57:03 +0100 |
commit | 734b6508a12b29444ec78fc07d3f3805cf06ea3c (patch) | |
tree | b91365eab9f68ac7c9864e5d98c8cde34b7b14d5 /hugolib/node_as_page_test.go | |
parent | e371ac0b6f56bdffe92b9e74dae571a003123912 (diff) |
node to page: Handle home
With refactored paginator handling.
Updates #2297
Diffstat (limited to 'hugolib/node_as_page_test.go')
-rw-r--r-- | hugolib/node_as_page_test.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/hugolib/node_as_page_test.go b/hugolib/node_as_page_test.go index 0bbc99fd8..722e5990c 100644 --- a/hugolib/node_as_page_test.go +++ b/hugolib/node_as_page_test.go @@ -18,6 +18,7 @@ import ( "path/filepath" "testing" + "github.com/spf13/viper" "github.com/stretchr/testify/require" ) @@ -54,6 +55,9 @@ Home **Content!** Index Title: {{ .Title }} Index Content: {{ .Content }} # Pages: {{ len .Data.Pages }} +{{ range .Paginator.Pages }} + Pag: {{ .Title }} +{{ end }} `) writeSource(t, filepath.Join("layouts", "_default", "single.html"), ` @@ -70,6 +74,8 @@ Content Page %d `, i, i)) } + viper.Set("paginate", 3) + s := newSiteDefaultLang() if err := buildAndRenderSite(s); err != nil { @@ -80,6 +86,7 @@ Content Page %d "Index Title: Home Sweet Home!", "Home <strong>Content!</strong>", "# Pages: 10") + assertFileContent(t, filepath.Join("public", "regular1", "index.html"), false, "Single Title: Page 1", "Content Page 1") h := s.owner @@ -100,4 +107,11 @@ Content Page %d require.False(t, first.IsNode()) require.True(t, first.IsPage()) + first.Paginator() + + // Check paginator + assertFileContent(t, filepath.Join("public", "page", "3", "index.html"), false, + "Pag: Page 6", + "Pag: Page 7") + } |