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:
Diffstat (limited to 'resources/page/permalinks.go')
-rw-r--r--resources/page/permalinks.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/resources/page/permalinks.go b/resources/page/permalinks.go
index 98489231b..59f2da916 100644
--- a/resources/page/permalinks.go
+++ b/resources/page/permalinks.go
@@ -15,6 +15,7 @@ package page
import (
"fmt"
+ "os"
"path/filepath"
"regexp"
"strconv"
@@ -90,7 +91,11 @@ func (l PermalinkExpander) parse(patterns map[string]string) (map[string]func(Pa
expanders := make(map[string]func(Page) (string, error))
+ // Allow " " and / to represent the root section.
+ const sectionCutSet = " /" + string(os.PathSeparator)
+
for k, pattern := range patterns {
+ k = strings.Trim(k, sectionCutSet)
if !l.validate(pattern) {
return nil, &permalinkExpandError{pattern: pattern, err: errPermalinkIllFormed}
}