mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
fixing badlink on homepage
This commit is contained in:
parent
6789b6c5ce
commit
783f0d6154
2 changed files with 8 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
Indexes:
|
indexes:
|
||||||
tag: 'tags'
|
tag: 'tags'
|
||||||
BaseUrl: 'http://localhost'
|
baseurl: 'http://hugo.spf13.com'
|
||||||
...
|
...
|
||||||
|
|
|
@ -200,10 +200,12 @@ func (s *Site) ProcessShortcodes() {
|
||||||
func (s *Site) AbsUrlify() {
|
func (s *Site) AbsUrlify() {
|
||||||
for i, _ := range s.Pages {
|
for i, _ := range s.Pages {
|
||||||
content := string(s.Pages[i].Content)
|
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, " 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, " 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)
|
s.Pages[i].Content = template.HTML(content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue