mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-14 16:17:21 +00:00
fixing badlink on homepage
This commit is contained in:
1 parent
6789b6c5ce
commit
783f0d6154
2 files changed
+8
-6
No files matched your search
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
Indexes:
|
indexes:
|
||||||
tag: 'tags'
|
tag: 'tags'
|
||||||
BaseUrl: 'http://localhost'
|
baseurl: 'http://hugo.spf13.com'
|
||||||
...
|
...
|
||||||
+6
-4
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user