Allow non-markdown content in content directory

Allow content that is not markdown and does not need to be rendered to
exists in the content directory.  Currently any valid html or xml
document can exist.  Templates are applied to these documents as well.
If you need to have content that doesn't have templates or AbsUrlify
like operations, then continue to put this content in static and it will
be copied over.
This commit is contained in:
Noah Campbell
2013-09-18 14:21:27 -07:00
parent 5374242ff7
commit 311e102223
5 changed files with 97 additions and 13 deletions

View File

@@ -286,7 +286,7 @@ func (s *Site) setUrlPath(p *Page) error {
x := strings.Split(y, "/")
if len(x) <= 1 {
return fmt.Errorf("Zero length page name")
return fmt.Errorf("Zero length page name. filename: %s", y)
}
p.Section = strings.Trim(x[1], "/")
@@ -400,9 +400,21 @@ func (s *Site) RenderAliases() error {
return nil
}
func (s *Site) RenderPages() error {
func (s *Site) RenderPages() (err error) {
for _, p := range s.Pages {
content, err := s.RenderThingOrDefault(p, p.Layout(), "_default/single.html")
var layout string
if !p.IsRenderable() {
layout = "__" + p.FileName
_, err := s.Tmpl.New(layout).Parse(string(p.Content))
if err != nil {
return err
}
} else {
layout = p.Layout()
}
content, err := s.RenderThingOrDefault(p, layout, "_default/single.html")
if err != nil {
return err
}