fix previous link; add more stuff

This commit is contained in:
Henrique Dias
2016-06-26 16:52:15 +01:00
parent ae6700709d
commit fff716b2b3
7 changed files with 150 additions and 139 deletions

View File

@@ -57,19 +57,16 @@ func (i Info) BreadcrumbMap() map[string]string {
// PreviousLink returns the path of the previous folder
func (i Info) PreviousLink() string {
parts := strings.Split(strings.TrimSuffix(i.Path, "/"), "/")
if len(parts) <= 1 {
path := strings.TrimSuffix(i.Path, "/")
path = strings.TrimPrefix(path, "/")
path = i.Config.BaseURL + "/" + path
path = path[0 : len(path)-len(i.Name)]
if len(path) < len(i.Config.BaseURL+"/") {
return ""
}
if parts[len(parts)-2] == "" {
if i.Config.BaseURL == "" {
return "/"
}
return i.Config.BaseURL
}
return parts[len(parts)-2]
return path
}
// PrintAsHTML formats the page in HTML and executes the template