ref: 783f0d615486314f84d1c25941e5975bb2afdf73
parent: 6789b6c5ce03f055e3e401a3c181fea722e2ccd0
author: spf13 <[email protected]>
date: Mon Aug 5 21:06:59 EDT 2013
fixing badlink on homepage
--- a/docs/config.yaml
+++ b/docs/config.yaml
@@ -1,4 +1,4 @@
-Indexes:
+indexes:
tag: 'tags'
-BaseUrl: 'http://localhost'
+baseurl: 'http://hugo.spf13.com'
...
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -200,10 +200,12 @@
func (s *Site) AbsUrlify() {
for i, _ := range s.Pages {
content := string(s.Pages[i].Content)
- content = strings.Replace(content, " src=\"/", " src=\""+s.c.BaseUrl+"/", -1)
- content = strings.Replace(content, " src='/", " src='"+s.c.BaseUrl+"/", -1)
- content = strings.Replace(content, " href='/", " href='"+s.c.BaseUrl+"/", -1)
- content = strings.Replace(content, " href=\"/", " href=\""+s.c.BaseUrl+"/", -1)
+ content = strings.Replace(content, " src=\"/", " src=\""+s.c.BaseUrl, -1)
+ content = strings.Replace(content, " src='/", " src='"+s.c.BaseUrl, -1)
+ content = strings.Replace(content, " href='/", " href='"+s.c.BaseUrl, -1)
+ content = strings.Replace(content, " href=\"/", " href=\""+s.c.BaseUrl, -1)
+ baseWithoutTrailingSlash := strings.TrimRight(s.c.BaseUrl, "/")
+ content = strings.Replace(content, baseWithoutTrailingSlash+"//", baseWithoutTrailingSlash+"/", -1)
s.Pages[i].Content = template.HTML(content)
}
}