hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 2890b6db362f10378c1cf1a8b66d6908b72a2c1c
parent 8a96234b1fd3e3724609425f03b60fba32003f92
Author: Takuya Wakisaka <takuya.wakisaka@moldweorp.com>
Date:   Fri, 10 Apr 2015 01:14:26 +0900

Fix UTF8 permalink

Generate unencoded directory in public dir.

Fixes #988

Diffstat:
Mhugolib/page.go | 9+++++----
Mhugolib/permalinks.go | 2+-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git 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
@@ -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)
 }