node to page: Basic outline

Updates #2297
This commit is contained in:
Bjørn Erik Pedersen
2016-10-30 17:59:24 +01:00
parent e7d0bc8a74
commit e371ac0b6f
8 changed files with 185 additions and 17 deletions

View File

@@ -31,6 +31,15 @@ import (
jww "github.com/spf13/jwalterweatherman"
)
// Temporary feature flag to ease the refactoring of node vs page, see
// https://github.com/spf13/hugo/issues/2297
// TODO(bep) eventually remove
var nodePageFeatureFlag bool
func toggleNodePageFeatureFlag() {
nodePageFeatureFlag = !nodePageFeatureFlag
}
// HugoSites represents the sites to build. Each site represents a language.
type HugoSites struct {
Sites []*Site
@@ -563,6 +572,16 @@ func (s *Site) updateBuildStats(page *Page) {
}
}
func (h *HugoSites) findPagesByNodeType(n NodeType) Pages {
var pages Pages
for _, p := range h.Sites[0].AllPages {
if p.NodeType == n {
pages = append(pages, p)
}
}
return pages
}
// Convenience func used in tests to build a single site/language excluding render phase.
func buildSiteSkipRender(s *Site, additionalTemplates ...string) error {
return doBuildSite(s, false, additionalTemplates...)