diff options
Diffstat (limited to 'hugolib/page.go')
-rw-r--r-- | hugolib/page.go | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/hugolib/page.go b/hugolib/page.go index 537482fb2..676cba762 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -23,6 +23,8 @@ import ( "sort" "strings" + "github.com/gohugoio/hugo/hugofs/files" + "github.com/bep/gitmap" "github.com/gohugoio/hugo/helpers" @@ -290,7 +292,9 @@ func (p *pageState) getLayoutDescriptor() output.LayoutDescriptor { switch p.Kind() { case page.KindSection: - section = sections[0] + if len(sections) > 0 { + section = sections[0] + } case page.KindTaxonomyTerm: section = p.getTaxonomyNodeInfo().singular case page.KindTaxonomy: @@ -365,6 +369,7 @@ func (p *pageState) renderResources() (err error) { var toBeDeleted []int for i, r := range p.Resources() { + if _, ok := r.(page.Page); ok { // Pages gets rendered with the owning page but we count them here. p.s.PathSpec.ProcessingStats.Incr(&p.s.PathSpec.ProcessingStats.Pages) @@ -491,14 +496,6 @@ func (p *pageState) addSectionToParent() { p.parent.subSections = append(p.parent.subSections, p) } -func (p *pageState) contentMarkupType() string { - if p.m.markup != "" { - return p.m.markup - - } - return p.File().Ext() -} - func (p *pageState) mapContent(meta *pageMeta) error { s := p.shortcodeState @@ -843,6 +840,7 @@ func (ps pageStatePages) findPagePosByFilnamePrefix(prefix string) int { func (s *Site) sectionsFromFile(fi source.File) []string { dirname := fi.Dir() + dirname = strings.Trim(dirname, helpers.FilePathSeparator) if dirname == "" { return nil @@ -850,7 +848,7 @@ func (s *Site) sectionsFromFile(fi source.File) []string { parts := strings.Split(dirname, helpers.FilePathSeparator) if fii, ok := fi.(*fileInfo); ok { - if fii.bundleTp == bundleLeaf && len(parts) > 0 { + if len(parts) > 0 && fii.FileInfo().Meta().Classifier() == files.ContentClassLeaf { // my-section/mybundle/index.md => my-section return parts[:len(parts)-1] } |