diff options
author | Anton Staaf <github@socialhacker.com> | 2017-03-05 12:24:14 -0800 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-03-05 21:24:14 +0100 |
commit | c95069990795965c34059b6844fe9fa5125be7c1 (patch) | |
tree | 026805cb68b325d3bf045dc86596aba8f415f2dd /hugolib/node_as_page_test.go | |
parent | 6c5ef71368edfae8ffc77224ff6a9ec240c39626 (diff) |
hugolib: Populate the taxonomy term Pages list
Previously this was left empty, but it is very handy to have a list
of term pages for a given taxonomy. This list can now be paginated
like other page lists. It makes it possible to render summary
content from each terms index page for instance. It also makes it
possible to sort the term pages in the same way that other page
lists can be sorted. An RSS feed is now generated for
KindTaxonomyTerm pages as well.
This also fixes a bug in HugoSites.createMissingPages. Previously
it would only check for existing KindTaxonomyTerm pages if the
taxonomy had any terms defined. So for a taxonomy with no terms
but a taxonomy terms page it would generate a second empty terms
page.
Diffstat (limited to 'hugolib/node_as_page_test.go')
-rw-r--r-- | hugolib/node_as_page_test.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/hugolib/node_as_page_test.go b/hugolib/node_as_page_test.go index f063faf9a..57a51f40a 100644 --- a/hugolib/node_as_page_test.go +++ b/hugolib/node_as_page_test.go @@ -176,7 +176,10 @@ func doTestNodeAsPage(t *testing.T, ugly, preserveTaxonomyNames bool) { "Lastmod: 2009-01-15", ) - // There are no pages to paginate over in the taxonomy terms. + // Check taxonomy terms paginator + th.assertFileContent(expectedFilePath(ugly, "public", "categories", "page", "2"), + "Taxonomy Terms Title: Taxonomy Term Categories", + "Pag: Taxonomy Web") // RSS th.assertFileContent(filepath.Join("public", "customrss.xml"), "Recent content in Home Sweet Home! on Hugo Rocks", "<rss") @@ -184,6 +187,7 @@ func doTestNodeAsPage(t *testing.T, ugly, preserveTaxonomyNames bool) { th.assertFileContent(filepath.Join("public", "sect2", "customrss.xml"), "Recent content in Section2 on Hugo Rocks", "<rss") th.assertFileContent(filepath.Join("public", "categories", "hugo", "customrss.xml"), "Recent content in Taxonomy Hugo on Hugo Rocks", "<rss") th.assertFileContent(filepath.Join("public", "categories", "web", "customrss.xml"), "Recent content in Taxonomy Web on Hugo Rocks", "<rss") + th.assertFileContent(filepath.Join("public", "categories", "customrss.xml"), "Recent content in Taxonomy Term Categories on Hugo Rocks", "<rss") } @@ -792,6 +796,10 @@ Lastmod: {{ .Lastmod.Format "2006-01-02" }} writeSource(t, fs, filepath.Join("layouts", "_default", "terms.html"), ` Taxonomy Terms Title: {{ .Title }} Taxonomy Terms Content: {{ .Content }} +# Pages: {{ len .Data.Pages }} +{{ range .Paginator.Pages }} + Pag: {{ .Title }} +{{ end }} {{ range $key, $value := .Data.Terms }} k/v: {{ $key | lower }} / {{ printf "%s" $value }} {{ end }} |