Skip to content

Commit

Permalink
Render non-collection pages
Browse files Browse the repository at this point in the history
  • Loading branch information
osteele committed Aug 10, 2017
1 parent c170df0 commit 44a04c4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion site/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions site/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
3 changes: 2 additions & 1 deletion site/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ type Site struct {
flags config.Flags
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
renderOnce sync.Once
Expand Down

0 comments on commit 44a04c4

Please sign in to comment.