mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-24 21:56:05 +02:00
Add PreserveTaxonomyNames flag
Before this commit, taxonomy names were hyphenated, lower-cased and normalized -- then fixed and titleized on the archive page. So what you entered in the front matter isn't necessarily what you got in the final site. To preserve backwards compability, `PreserveTaxonomyNames` is default `false`. Setting it to `true` will preserve what you type (the first characters is made toupper for titles), but normalized in URLs. This also means that, if you manually construct URLs to the archive pages, you will have to pass the Taxonomy names through the `urlize` func. Fixes #1180
This commit is contained in:
@@ -65,8 +65,10 @@ func kp(in string) string {
|
||||
|
||||
func (i Taxonomy) Get(key string) WeightedPages { return i[kp(key)] }
|
||||
func (i Taxonomy) Count(key string) int { return len(i[kp(key)]) }
|
||||
func (i Taxonomy) Add(key string, w WeightedPage) {
|
||||
key = kp(key)
|
||||
func (i Taxonomy) Add(key string, w WeightedPage, pretty bool) {
|
||||
if !pretty {
|
||||
key = kp(key)
|
||||
}
|
||||
i[key] = append(i[key], w)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user