URI: 
       Fix taxonomy - hugo - [fork] hugo port for 9front
  HTML git clone git@git.drkhsh.at/hugo.git
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit 1b7acfe7634a5d7bbc597ef4dddf4babce5666c5
   DIR parent 19e12caf8c90516e3b803ae8a40b907bd89dc96c
  HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
       Date:   Tue, 18 Feb 2020 16:16:09 +0100
       
       Fix taxonomy
       
       Recently introduced in master.
       
       See https://github.com/gohugoio/hugo/issues/6897#issuecomment-587499907
       
       Diffstat:
         M hugolib/content_map.go              |       4 ++++
         M hugolib/page__tree.go               |       4 ++++
         M hugolib/taxonomy_test.go            |      27 +++++++++++++++++++++++++++
       
       3 files changed, 35 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/hugolib/content_map.go b/hugolib/content_map.go
       @@ -533,6 +533,7 @@ func (m *contentMap) getPage(section, name string) *contentNode {
        
        func (m *contentMap) getSection(s string) (string, *contentNode) {
                k, v, found := m.sections.LongestPrefix(path.Dir(s))
       +
                if found {
                        return k, v.(*contentNode)
                }
       @@ -919,6 +920,9 @@ func (c *contentTreeRef) isSection() bool {
        }
        
        func (c *contentTreeRef) getSection() (string, *contentNode) {
       +        if c.t == c.m.taxonomies {
       +                return c.m.getTaxonomyParent(c.key)
       +        }
                return c.m.getSection(c.key)
        }
        
   DIR diff --git a/hugolib/page__tree.go b/hugolib/page__tree.go
       @@ -121,6 +121,10 @@ func (pt pageTree) Parent() page.Page {
                        return nil
                }
        
       +        if pt.p.Kind() == page.KindTaxonomyTerm {
       +                return pt.p.s.home
       +        }
       +
                _, b := p.getTreeRef().getSection()
                if b == nil {
                        return nil
   DIR diff --git a/hugolib/taxonomy_test.go b/hugolib/taxonomy_test.go
       @@ -537,3 +537,30 @@ categories.funny:|/blog/p1/|
        `)
        
        }
       +
       +func TestTaxonomiesParent(t *testing.T) {
       +        t.Parallel()
       +
       +        b := newTestSitesBuilder(t)
       +        b.WithContent("p.md", `---
       +title: "Page"
       +categories: ["funny"]
       +---
       +
       +`)
       +
       +        b.Build(BuildCfg{})
       +
       +        cat := b.GetPage("categories")
       +        funny := b.GetPage("categories/funny")
       +
       +        b.Assert(cat, qt.Not(qt.IsNil))
       +        b.Assert(funny, qt.Not(qt.IsNil))
       +
       +        b.Assert(cat.Parent().IsHome(), qt.Equals, true)
       +        b.Assert(funny.Parent(), qt.Equals, cat)
       +
       +        b.AssertFileContent("public/categories/funny/index.xml", `<link>http://example.com/p/</link>`)
       +        // TODO https://github.com/gohugoio/hugo/issues/6909        b.AssertFileContent("public/categories/index.xml", `<link>http://example.com/categories/funny/</link>`)
       +
       +}