avoid handling a redirect from slug to slug/
authorelij <elij@wundrd.net>
Fri, 16 Aug 2013 20:14:20 +0000 (13:14 -0700)
committerelij <elij@wundrd.net>
Fri, 16 Aug 2013 20:14:20 +0000 (13:14 -0700)
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.

hugolib/page.go

index aca0bc2033b4f6a4eb44cbf89b0d00e36192e9ee..c3aebb3f2b613f2018ddd2eeda399f742af3427d 100644 (file)
@@ -192,7 +192,7 @@ func (p *Page) Permalink() template.HTML {
                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)))