From 44a04c41fbd7e5338b4ef8086f6b15d8bcc90028 Mon Sep 17 00:00:00 2001 From: Oliver Steele Date: Thu, 10 Aug 2017 11:45:46 -0400 Subject: [PATCH] Render non-collection pages --- site/read.go | 5 ++++- site/render.go | 5 +++++ site/site.go | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/site/read.go b/site/read.go index 66a4f5c..695e38d 100644 --- a/site/read.go +++ b/site/read.go @@ -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 { diff --git a/site/render.go b/site/render.go index 15af0eb..52eb589 100644 --- a/site/render.go +++ b/site/render.go @@ -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 } diff --git a/site/site.go b/site/site.go index dee76c6..bf00e9c 100644 --- a/site/site.go +++ b/site/site.go @@ -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