mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
fixing badlink on homepage
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
Indexes:
|
||||
indexes:
|
||||
tag: 'tags'
|
||||
BaseUrl: 'http://localhost'
|
||||
baseurl: 'http://hugo.spf13.com'
|
||||
...
|
||||
|
@@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user