This commit is contained in:
Henrique Dias
2016-06-14 18:19:10 +01:00
parent 8393244e9d
commit e137f46169
7 changed files with 157 additions and 64 deletions

11
page.go
View File

@@ -49,6 +49,17 @@ func (p PageInfo) BreadcrumbMap() map[string]string {
return result
}
// PreviousLink returns the path of the previous folder
func (p PageInfo) PreviousLink() string {
parts := strings.Split(p.Path, "/")
if len(parts) <= 1 {
return ""
}
return parts[len(parts)-2]
}
// PrintAsHTML formats the page in HTML and executes the template
func (p Page) PrintAsHTML(w http.ResponseWriter, templates ...string) (int, error) {
templates = append(templates, "base")