node to page: Do not create section node for root

Because that will overwrite the home page, which is bad.

Updates #2297
This commit is contained in:
Bjørn Erik Pedersen
2016-11-09 11:09:16 +01:00
parent 503fb29953
commit 7cc637e97a
2 changed files with 33 additions and 18 deletions

View File

@@ -461,6 +461,13 @@ func (h *HugoSites) createMissingNodes() error {
sectionPages := s.findPagesByNodeType(NodeSection)
if len(sectionPages) < len(s.Sections) {
for name, section := range s.Sections {
// A section may be created for the root content folder if a
// content file is placed there.
// We cannot create a section node for that, because
// that would overwrite the home page.
if name == "" {
continue
}
foundSection := false
for _, sectionPage := range sectionPages {
if sectionPage.sections[0] == name {