diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go index 9c931c5f6..89fcbea73 100644 --- a/hugolib/hugo_sites.go +++ b/hugolib/hugo_sites.go @@ -569,6 +569,7 @@ func (s *Site) newTaxonomyTermsPage(plural string) *Page { p := s.newNodePage(NodeTaxonomyTerms) p.sections = []string{plural} p.Title = strings.Title(plural) + s.setPageURLs(p, plural) return p } diff --git a/hugolib/page_collections.go b/hugolib/page_collections.go index d63e9631a..cb83c77a8 100644 --- a/hugolib/page_collections.go +++ b/hugolib/page_collections.go @@ -123,7 +123,7 @@ func (*PageCollections) findPagesByNodeTypeNotIn(n NodeType, inPages Pages) Page } func (c *PageCollections) findAllPagesByNodeType(n NodeType) Pages { - return c.findPagesByNodeTypeIn(n, c.rawAllPages) + return c.findPagesByNodeTypeIn(n, c.Nodes) } func (c *PageCollections) findRawAllPagesByNodeType(n NodeType) Pages { diff --git a/hugolib/site_render.go b/hugolib/site_render.go index 4bc4a5e70..8777d91a7 100644 --- a/hugolib/site_render.go +++ b/hugolib/site_render.go @@ -182,19 +182,18 @@ func (s *Site) renderSitemap() error { n := s.newNodePage(NodeSitemap) - // Prepend homepage to the list of pages - pages := make(Pages, 0) + // Include all pages (regular, home page, taxonomies etc.) + pages := s.Nodes page := s.newNodePage(NodeSitemap) page.URLPath.URL = "" page.Sitemap.ChangeFreq = sitemapDefault.ChangeFreq page.Sitemap.Priority = sitemapDefault.Priority - - pages = append(pages, page) - pages = append(pages, s.Pages...) + page.Sitemap.Filename = sitemapDefault.Filename n.Data["Pages"] = pages + // TODO(bep) this should be done somewhere else for _, page := range pages { if page.Sitemap.ChangeFreq == "" { page.Sitemap.ChangeFreq = sitemapDefault.ChangeFreq diff --git a/hugolib/sitemap_test.go b/hugolib/sitemap_test.go index 0ec51497a..72fcb2048 100644 --- a/hugolib/sitemap_test.go +++ b/hugolib/sitemap_test.go @@ -17,7 +17,6 @@ import ( "testing" "reflect" - "strings" "github.com/spf13/hugo/helpers" "github.com/spf13/hugo/source" @@ -36,6 +35,12 @@ const SITEMAP_TEMPLATE = `http://auth/bub/sect/doc1/", + // Home page + "http://auth/bub/", + // Section + "http://auth/bub/sect/", + // Tax terms + "http://auth/bub/categories/", + // Tax list + "http://auth/bub/categories/hugo/", + ) - if !strings.HasPrefix(sitemapContent, "