node to page: Export GetPage to the templates

Updates #2297
This commit is contained in:
Bjørn Erik Pedersen
2016-11-12 17:30:21 +01:00
parent 487b210fb8
commit 96f71141bd
3 changed files with 17 additions and 2 deletions

View File

@@ -1653,6 +1653,19 @@ func (s *Site) Stats() {
}
// GetPage looks up a index page of a given type in the path given.
// This method may support regular pages in the future, but currently it is a
// convenient way of getting the home page or
// a section from a template:
// {{ with .Site.GetPage "section" "blog" }}{{ .Title }}{{ end }}
//
// This will return nil when no page could be found.
//
// The valid page types are: home, section, taxonomy and taxonomyTerm
func (s *SiteInfo) GetPage(typ PageType, path ...string) *Page {
return s.getPage(typ, path...)
}
func (s *SiteInfo) permalink(plink string) string {
return s.permalinkStr(plink)
}