Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbep <bjorn.erik.pedersen@gmail.com>2015-05-10 19:28:47 +0300
committerbep <bjorn.erik.pedersen@gmail.com>2015-05-10 19:28:44 +0300
commitbec90e085055ef96cbd6a17604cf1020c2c82f24 (patch)
tree4afa72c7b9c95709fa7d7f990bd39101aab245ff /helpers
parentbe0c1bfe132c871d765acdb9d45a0394dd99c01d (diff)
Make page 1 alias ugly
When `uglyurls = true` Fixes #1121
Diffstat (limited to 'helpers')
-rw-r--r--helpers/path.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/helpers/path.go b/helpers/path.go
index 53e29591f..e7b84ade3 100644
--- a/helpers/path.go
+++ b/helpers/path.go
@@ -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.