resource: Add front matter metadata to Resource

This commit expands the Resource interface with 3 new methods:

* Name
* Title
* Params

All of these can be set in the Page front matter. `Name` will get its default value from the base filename, and is the value used in the ByPrefix and GetByPrefix lookup methods.

Fixes #4244
This commit is contained in:
Bjørn Erik Pedersen 2018-01-15 20:40:39 +01:00
parent f8a119b606
commit 20c9b6ec81
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
27 changed files with 627 additions and 187 deletions

View file

@ -212,7 +212,7 @@ func (s *Site) renderPaginator(p *PageOutput) error {
if err := s.renderAndWritePage(
&s.PathSpec.ProcessingStats.PaginatorPages,
pagerNode.Title,
pagerNode.title,
targetPath, pagerNode, layouts...); err != nil {
return err
}
@ -252,7 +252,7 @@ func (s *Site) renderRSS(p *PageOutput) error {
return err
}
return s.renderAndWriteXML(&s.PathSpec.ProcessingStats.Pages, p.Title,
return s.renderAndWriteXML(&s.PathSpec.ProcessingStats.Pages, p.title,
targetPath, p, layouts...)
}
@ -267,7 +267,7 @@ func (s *Site) render404() error {
p := s.newNodePage(kind404)
p.Title = "404 Page not found"
p.title = "404 Page not found"
p.Data["Pages"] = s.Pages
p.Pages = s.Pages
p.URLPath.URL = "404.html"