shithub: hugo

Download patch

ref: b9e835b1012350d5b043568b126a90a316ca50cd
parent: 3c3fc45d3c34a7dcd1a0e9fd2636e7a5c5933e03
author: elij <[email protected]>
date: Fri Aug 16 09:14:20 EDT 2013

avoid handling a redirect from slug to slug/

because the url lacks a trailing /, many webservers will issue a
redirect to the canonical url with trailing slash for directory index
w/index.htm(l).
Append a slash to avoid this.

--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -192,7 +192,7 @@
 		if p.Site.Config.UglyUrls {
 			return template.HTML(MakePermalink(string(p.Site.BaseUrl), strings.TrimSpace(p.Section)+"/"+p.Slug+"."+p.Extension))
 		} else {
-			return template.HTML(MakePermalink(string(p.Site.BaseUrl), strings.TrimSpace(p.Section)+"/"+p.Slug))
+			return template.HTML(MakePermalink(string(p.Site.BaseUrl), strings.TrimSpace(p.Section)+"/"+p.Slug+"/"))
 		}
 	} else if len(strings.TrimSpace(p.Url)) > 2 {
 		return template.HTML(MakePermalink(string(p.Site.BaseUrl), strings.TrimSpace(p.Url)))