mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
Support Fish and Chips
section
Section names are also used as the title of the list pages, but naming section folders as `Fish and Chips` and similar didn't work very well. This commit fixes that. This commit also changes the title casing of the section titles. Some may argue that this is a breaking change, but the old behaviour was also pretty broken, even for languages that use title capitalizations, as it didn't follow any particular style guide, `fish and chips` became `Fish And Chips` etc. Now it just turns the first letter into upper case, so `Fish and Chips` will be left as `Fish and Chips`. People wanting the good old behaviour can use the `title` template func. Fixes #1176
This commit is contained in:
@@ -346,7 +346,7 @@ func (p *Page) analyzePage() {
|
||||
|
||||
func (p *Page) permalink() (*url.URL, error) {
|
||||
baseURL := string(p.Site.BaseURL)
|
||||
dir := strings.TrimSpace(filepath.ToSlash(p.Source.Dir()))
|
||||
dir := strings.TrimSpace(helpers.MakePath(filepath.ToSlash(strings.ToLower(p.Source.Dir()))))
|
||||
pSlug := strings.TrimSpace(helpers.URLize(p.Slug))
|
||||
pURL := strings.TrimSpace(helpers.URLize(p.URL))
|
||||
var permalink string
|
||||
@@ -837,5 +837,5 @@ func (p *Page) TargetPath() (outfile string) {
|
||||
outfile = helpers.ReplaceExtension(p.Source.LogicalName(), p.Extension())
|
||||
}
|
||||
|
||||
return filepath.Join(p.Source.Dir(), strings.TrimSpace(outfile))
|
||||
return filepath.Join(strings.ToLower(helpers.MakePath(p.Source.Dir())), strings.TrimSpace(outfile))
|
||||
}
|
||||
|
Reference in New Issue
Block a user