summaryrefslogtreecommitdiffstats
path: root/hugolib/hugo_sites.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-12-29 10:00:17 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-12-29 10:00:17 +0100
commit65fa0692712b4c62b48b3a537b74cdd904e95246 (patch)
treedffeb728a5bd2217c49f8cf7438eed79d135b412 /hugolib/hugo_sites.go
parent9e4f9e0bb69276e9bca0dfbdbc7aefbf5f6fc9e5 (diff)
Revert "hugolib: Restore taxonomy term path separation"
See #5571 This reverts commit 9ce0a1fb7011bd75eb0e2262e35354c49ce98ac5.
Diffstat (limited to 'hugolib/hugo_sites.go')
-rw-r--r--hugolib/hugo_sites.go20
1 files changed, 5 insertions, 15 deletions
diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go
index a211956df..e44390e4b 100644
--- a/hugolib/hugo_sites.go
+++ b/hugolib/hugo_sites.go
@@ -16,7 +16,6 @@ package hugolib
import (
"errors"
"io"
- "path"
"path/filepath"
"sort"
"strings"
@@ -521,15 +520,6 @@ func (h *HugoSites) assignMissingTranslations() error {
func (h *HugoSites) createMissingPages() error {
var newPages Pages
- singularPlural := func(p *Page) (string, string) {
- slen := len(p.sections)
- singular := p.sections[slen-1]
- singular = p.s.PathSpec.MakePathSanitized(singular)
- plural := path.Join((p.sections[:slen-1])...)
-
- return singular, plural
- }
-
for _, s := range h.Sites {
if s.isEnabled(KindHome) {
// home pages
@@ -554,7 +544,6 @@ func (h *HugoSites) createMissingPages() error {
if len(taxonomies) > 0 {
taxonomyPages := s.findPagesByKind(KindTaxonomy)
taxonomyTermsPages := s.findPagesByKind(KindTaxonomyTerm)
-
for _, plural := range taxonomies {
if s.isEnabled(KindTaxonomyTerm) {
foundTaxonomyTermsPage := false
@@ -581,10 +570,11 @@ func (h *HugoSites) createMissingPages() error {
key = s.PathSpec.MakeSegment(key)
}
for _, p := range taxonomyPages {
-
- singularKey, pluralKey := singularPlural(p)
-
- if pluralKey == plural && singularKey == key {
+ // Some people may have /authors/MaxMustermann etc. as paths.
+ // p.sections contains the raw values from the file system.
+ // See https://github.com/gohugoio/hugo/issues/4238
+ singularKey := s.PathSpec.MakePathSanitized(p.sections[1])
+ if p.sections[0] == plural && singularKey == key {
foundTaxonomyPage = true
break
}