summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTakuya Wakisaka <[email protected]>2015-04-10 01:14:26 +0900
committerbep <[email protected]>2015-05-17 14:54:59 +0200
commit2890b6db362f10378c1cf1a8b66d6908b72a2c1c (patch)
treecc9af52c4afe430e6bb7a07c4f82d2e07d0ec6e5
parent8a96234b1fd3e3724609425f03b60fba32003f92 (diff)
downloadhugo-2890b6db362f10378c1cf1a8b66d6908b72a2c1c.tar.gz
hugo-2890b6db362f10378c1cf1a8b66d6908b72a2c1c.zip
Fix UTF8 permalink
Generate unencoded directory in public dir. Fixes #988
-rw-r--r--hugolib/page.go9
-rw-r--r--hugolib/permalinks.go2
2 files changed, 6 insertions, 5 deletions
diff --git a/hugolib/page.go b/hugolib/page.go
index fd3bddcdb..fd51e7263 100644
--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -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"
}
diff --git a/hugolib/permalinks.go b/hugolib/permalinks.go
index 325fbfe4b..81416e7e8 100644
--- a/hugolib/permalinks.go
+++ b/hugolib/permalinks.go
@@ -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)
}