diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-06-30 16:50:02 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-06-30 16:50:02 +0200 |
commit | 78e8a744b34e885e8169bf0a8bb64c73288e555a (patch) | |
tree | 09b6b272493637b6de9d0f0cb72470e73c3e8028 /hugolib | |
parent | c790029e1dbb0b66af18d05764bd6045deb2e180 (diff) |
Restrict the new type layout resolution to page and section kinds
Will have to test and evaluate this a little.
See #4891
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/page.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/hugolib/page.go b/hugolib/page.go index 458b96b28..13907c39e 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -407,14 +407,16 @@ func (p *Page) createLayoutDescriptor() output.LayoutDescriptor { var typeCurrentSection string var typeRootSection string - curr := p.CurrentSection() - // Make sure we use the contentType only. This is the value from front matter. - if curr != nil { - typeCurrentSection = curr.contentType - } - first := p.FirstSection() - if first != nil { - typeRootSection = first.contentType + if p.Kind == KindPage || p.Kind == KindSection { + curr := p.CurrentSection() + // Make sure we use the contentType only. This is the value from front matter. + if curr != nil { + typeCurrentSection = curr.contentType + } + first := p.FirstSection() + if first != nil { + typeRootSection = first.contentType + } } return output.LayoutDescriptor{ |