Make page 1 alias ugly

When `uglyurls = true`

Fixes #1121
This commit is contained in:
bep
2015-05-10 18:28:47 +02:00
parent be0c1bfe13
commit bec90e0850
2 changed files with 19 additions and 3 deletions

View File

@@ -299,6 +299,22 @@ func GetRelativePath(path, base string) (final string, err error) {
return name, nil
}
func PaginateAliasPath(base string, page int) string {
paginatePath := viper.GetString("paginatePath")
uglify := viper.GetBool("UglyURLs")
var p string
if base != "" {
p = filepath.FromSlash(fmt.Sprintf("/%s/%s/%d", base, paginatePath, page))
} else {
p = filepath.FromSlash(fmt.Sprintf("/%s/%d", paginatePath, page))
}
if uglify {
p += ".html"
}
return p
}
// GuessSection returns the section given a source path.
// A section is the part between the root slash and the second slash
// or before the first slash.