mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Fix UTF8 permalink
Generate unencoded directory in public dir. Fixes #988
This commit is contained in:
parent
8a96234b1f
commit
2890b6db36
2 changed files with 6 additions and 5 deletions
|
@ -347,8 +347,8 @@ func (p *Page) analyzePage() {
|
|||
func (p *Page) permalink() (*url.URL, error) {
|
||||
baseURL := string(p.Site.BaseURL)
|
||||
dir := strings.TrimSpace(filepath.ToSlash(p.Source.Dir()))
|
||||
pSlug := strings.TrimSpace(p.Slug)
|
||||
pURL := strings.TrimSpace(p.URL)
|
||||
pSlug := strings.TrimSpace(helpers.URLize(p.Slug))
|
||||
pURL := strings.TrimSpace(helpers.URLize(p.URL))
|
||||
var permalink string
|
||||
var err error
|
||||
|
||||
|
@ -456,12 +456,12 @@ func (p *Page) update(f interface{}) error {
|
|||
case "description":
|
||||
p.Description = cast.ToString(v)
|
||||
case "slug":
|
||||
p.Slug = helpers.URLize(cast.ToString(v))
|
||||
p.Slug = cast.ToString(v)
|
||||
case "url":
|
||||
if url := cast.ToString(v); strings.HasPrefix(url, "http://") || strings.HasPrefix(url, "https://") {
|
||||
return fmt.Errorf("Only relative URLs are supported, %v provided", url)
|
||||
}
|
||||
p.URL = helpers.URLize(cast.ToString(v))
|
||||
p.URL = cast.ToString(v)
|
||||
case "type":
|
||||
p.contentType = cast.ToString(v)
|
||||
case "extension", "ext":
|
||||
|
@ -821,6 +821,7 @@ func (p *Page) TargetPath() (outfile string) {
|
|||
var err error
|
||||
outfile, err = override.Expand(p)
|
||||
if err == nil {
|
||||
outfile, _ = url.QueryUnescape(outfile)
|
||||
if strings.HasSuffix(outfile, "/") {
|
||||
outfile += "index.html"
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ func pageToPermalinkSlugElseTitle(p *Page, a string) (string, error) {
|
|||
if strings.HasSuffix(p.Slug, "-") {
|
||||
p.Slug = p.Slug[0 : len(p.Slug)-1]
|
||||
}
|
||||
return p.Slug, nil
|
||||
return helpers.URLize(p.Slug), nil
|
||||
}
|
||||
return pageToPermalinkTitle(p, a)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue