diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-10-03 10:14:45 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-10-03 15:55:25 +0200 |
commit | e421696d02bfb8764ae57238e211ce0e85e9782e (patch) | |
tree | c50ea4931bc05be44192cd3178c62f24ec2c72d4 /hugolib/permalinks.go | |
parent | 4b4af2c52e658d516dd4bfaf59fef4f054dabec3 (diff) |
helpers: Consolidate MakeSegment vs MakePathSanitized
In short:
* Avoid double tolower in MakeSegment
* Use MakePathSanitized for taxonomies in pageToPermalinkTitle; this matches what MakeSegment does.
* Move the "double hyphen and space" logic into UnicodeSanitize
The last bullet may be slightly breaking for some that now does not get the "--" in some URLs, but we need to reduce the amount of URL logic.
See #4926
Diffstat (limited to 'hugolib/permalinks.go')
-rw-r--r-- | hugolib/permalinks.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hugolib/permalinks.go b/hugolib/permalinks.go index c452cf55d..f306f494d 100644 --- a/hugolib/permalinks.go +++ b/hugolib/permalinks.go @@ -152,10 +152,10 @@ func pageToPermalinkDate(p *Page, dateField string) (string, error) { // pageToPermalinkTitle returns the URL-safe form of the title func pageToPermalinkTitle(p *Page, _ string) (string, error) { - if p.Kind == "taxonomy" { + if p.Kind == KindTaxonomy { // Taxonomies are allowed to have '/' characters, so don't normalize // them with MakeSegment. - return p.s.PathSpec.URLize(p.title), nil + return p.s.PathSpec.MakePathSanitized(p.title), nil } return p.s.PathSpec.MakeSegment(p.title), nil |