Handle Taxonomy permalinks

Return the correct virtual Section for Taxonomy and TaxonomyTerm.
Restrict permalink expansion to only Pages and Taxonomies, but then
actually use expanded permalinks even for non-Pages.

Fixes #1208.
This commit is contained in:
Brian Chen
2017-11-06 22:58:41 -05:00
committed by Bjørn Erik Pedersen
parent 23ba779fab
commit d9a78b61ad
5 changed files with 48 additions and 20 deletions

View File

@@ -758,7 +758,7 @@ func (p *Page) Type() string {
// since Hugo 0.22 we support nested sections, but this will always be the first
// element of any nested path.
func (p *Page) Section() string {
if p.Kind == KindSection {
if p.Kind == KindSection || p.Kind == KindTaxonomy || p.Kind == KindTaxonomyTerm {
return p.sections[0]
}
return p.Source.Section()