node to page: Add Pages to Page

As an alias to .Data.Pages for home page etc.

Also renamte NodeType to PageType and make it a string so it can be used in `where`.

Updates #2297
This commit is contained in:
Bjørn Erik Pedersen
2016-11-11 09:19:16 +01:00
parent 063b78d2ec
commit c80308e6b3
13 changed files with 204 additions and 209 deletions

View File

@@ -1533,8 +1533,8 @@ func (s *Site) assembleSections() {
s.Sections = make(Taxonomy)
s.Info.Sections = s.Sections
// TODO(bep) np check these vs the caches
regularPages := s.findPagesByNodeType(NodePage)
sectionPages := s.findPagesByNodeType(NodeSection)
regularPages := s.findPagesByNodeType(PagePage)
sectionPages := s.findPagesByNodeType(PageSection)
for i, p := range regularPages {
s.Sections.add(p.Section(), WeightedPage{regularPages[i].Weight, regularPages[i]}, s.Info.preserveTaxonomyNames)
@@ -1561,14 +1561,14 @@ func (s *Site) assembleSections() {
}
}
func (s *Site) nodeTypeFromSections(sections []string) NodeType {
func (s *Site) nodeTypeFromSections(sections []string) PageType {
if _, isTaxonomy := s.Taxonomies[sections[0]]; isTaxonomy {
if len(sections) == 1 {
return NodeTaxonomyTerms
return PageTaxonomyTerm
}
return NodeTaxonomy
return PageTaxonomy
}
return NodeSection
return PageSection
}
func (s *Site) preparePages() error {