1
0
mirror of https://github.com/danog/gojekyll.git synced 2025-01-23 02:11:17 +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) return utils.WrapPathError(err, filename)
} }
s.AddDocument(d, true) s.AddDocument(d, true)
if p, ok := d.(pages.Page); ok {
s.nonCollectionPages = append(s.nonCollectionPages, p)
}
return nil 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. // It ignores unpublished documents unless config.Unpublished is true.
func (s *Site) AddDocument(d pages.Document, output bool) { func (s *Site) AddDocument(d pages.Document, output bool) {
if d.Published() || s.config.Unpublished { if d.Published() || s.config.Unpublished {

View File

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

View File

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