1
0
mirror of https://github.com/danog/gojekyll.git synced 2025-01-22 23:11:26 +01:00

Render non-collection pages

This commit is contained in:
Oliver Steele 2017-08-10 11:45:46 -04:00
parent c170df0ce5
commit 44a04c41fb
3 changed files with 11 additions and 2 deletions

View File

@ -70,11 +70,14 @@ func (s *Site) readFiles(dir, base string) error {
return utils.WrapPathError(err, filename)
}
s.AddDocument(d, true)
if p, ok := d.(pages.Page); ok {
s.nonCollectionPages = append(s.nonCollectionPages, p)
}
return nil
})
}
// AddDocument adds a document to the site structures.
// AddDocument adds a document to the site's fields.
// It ignores unpublished documents unless config.Unpublished is true.
func (s *Site) AddDocument(d pages.Document, output bool) {
if d.Published() || s.config.Unpublished {

View File

@ -16,6 +16,11 @@ func (s *Site) Render() error {
return err
}
}
for _, c := range s.nonCollectionPages {
if err := c.Render(); err != nil {
return err
}
}
return nil
}

View File

@ -26,6 +26,7 @@ type Site struct {
themeDir string
docs []pages.Document // all documents, whether or not they are output
nonCollectionPages []pages.Page
pipeline *pipelines.Pipeline
renderOnce sync.Once