From 783f0d615486314f84d1c25941e5975bb2afdf73 Mon Sep 17 00:00:00 2001 From: spf13 Date: Tue, 6 Aug 2013 01:06:59 +0200 Subject: [PATCH] fixing badlink on homepage --- docs/config.yaml | 4 ++-- hugolib/site.go | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/config.yaml b/docs/config.yaml index 771552606..ff2577f0b 100644 --- a/docs/config.yaml +++ b/docs/config.yaml @@ -1,4 +1,4 @@ -Indexes: +indexes: tag: 'tags' -BaseUrl: 'http://localhost' +baseurl: 'http://hugo.spf13.com' ... diff --git a/hugolib/site.go b/hugolib/site.go index 8b7d86c93..b2eb70cfe 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -200,10 +200,12 @@ func (s *Site) ProcessShortcodes() { 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) } }