Skip to content

Commit

Permalink
hugolib: Fix handling of taxonomy terms containing slashes
Browse files Browse the repository at this point in the history
This commit attempts to sanitize term keys and path segments to fix the
handling of taxonomy terms containing slashes.

Based upon gohugoio#4092 by @tsuereth.

Fixes gohugoio#4090
  • Loading branch information
moorereason committed Feb 8, 2018
1 parent be47d54 commit e6289d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hugolib/hugo_sites.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ func (h *HugoSites) createMissingPages() error {
origKey := key

if s.Info.preserveTaxonomyNames {
key = s.PathSpec.MakePathSanitized(key)
key = s.PathSpec.MakeSegment(key)
}
for _, p := range taxonomyPages {
// Some people may have /authors/MaxMustermann etc. as paths.
Expand Down
8 changes: 7 additions & 1 deletion hugolib/page_paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,13 @@ func createTargetPath(d targetPathDescriptor) string {
if d.ExpandedPermalink != "" {
pagePath = filepath.Join(pagePath, d.ExpandedPermalink)
} else {
pagePath = filepath.Join(d.Sections...)
pagePath = ""
for i, section := range d.Sections {
if i > 0 {
pagePath += helpers.FilePathSeparator
}
pagePath += d.PathSpec.MakeSegment(section)
}
}
needsBase = false
}
Expand Down

0 comments on commit e6289d2

Please sign in to comment.