mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
fixing badlink on homepage
This commit is contained in:
@@ -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