mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-22 21:42:50 +02:00
Revert "hugolib: Restore taxonomy term path separation"
See #5571
This reverts commit 9ce0a1fb70
.
This commit is contained in:
@@ -22,7 +22,6 @@ import (
|
||||
"mime"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strconv"
|
||||
@@ -1587,28 +1586,11 @@ func (s *Site) resetBuildState() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Site) singularPluralAll(sections []string) (string, string, string) {
|
||||
slen := len(sections)
|
||||
singular := sections[slen-1]
|
||||
plural := path.Join((sections[:slen-1])...)
|
||||
all := path.Join(sections...)
|
||||
|
||||
return singular, plural, all
|
||||
}
|
||||
|
||||
func (s *Site) kindFromSections(sections []string) string {
|
||||
if len(sections) == 0 {
|
||||
return KindSection
|
||||
}
|
||||
|
||||
_, plural, all := s.singularPluralAll(sections)
|
||||
|
||||
if _, ok := s.Taxonomies[all]; ok {
|
||||
return KindTaxonomyTerm
|
||||
} else if _, ok := s.Taxonomies[plural]; ok {
|
||||
return KindTaxonomy
|
||||
}
|
||||
|
||||
if _, isTaxonomy := s.Taxonomies[sections[0]]; isTaxonomy {
|
||||
if len(sections) == 1 {
|
||||
return KindTaxonomyTerm
|
||||
@@ -1864,10 +1846,8 @@ func (s *Site) newHomePage() *Page {
|
||||
}
|
||||
|
||||
func (s *Site) newTaxonomyPage(plural, key string) *Page {
|
||||
sections := strings.Split(plural, "/")
|
||||
sections = append(sections, key)
|
||||
|
||||
p := s.newNodePage(KindTaxonomy, sections...)
|
||||
p := s.newNodePage(KindTaxonomy, plural, key)
|
||||
|
||||
if s.Info.preserveTaxonomyNames {
|
||||
p.title = key
|
||||
@@ -1891,7 +1871,7 @@ func (s *Site) newSectionPage(name string) *Page {
|
||||
}
|
||||
|
||||
func (s *Site) newTaxonomyTermsPage(plural string) *Page {
|
||||
p := s.newNodePage(KindTaxonomyTerm, strings.Split(plural, "/")...)
|
||||
p := s.newNodePage(KindTaxonomyTerm, plural)
|
||||
p.title = s.titleFunc(plural)
|
||||
return p
|
||||
}
|
||||
|
Reference in New Issue
Block a user