mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Fixing missing trailing slash in baseUrl
This commit is contained in:
parent
d89c7ec7a2
commit
a870f4d955
1 changed files with 7 additions and 6 deletions
|
@ -198,14 +198,15 @@ func (s *Site) ProcessShortcodes() {
|
|||
}
|
||||
|
||||
func (s *Site) AbsUrlify() {
|
||||
baseWithoutTrailingSlash := strings.TrimRight(s.c.BaseUrl, "/")
|
||||
baseWithSlash := baseWithoutTrailingSlash + "/"
|
||||
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)
|
||||
baseWithoutTrailingSlash := strings.TrimRight(s.c.BaseUrl, "/")
|
||||
content = strings.Replace(content, baseWithoutTrailingSlash+"//", baseWithoutTrailingSlash+"/", -1)
|
||||
content = strings.Replace(content, " src=\"/", " src=\""+baseWithSlash, -1)
|
||||
content = strings.Replace(content, " src='/", " src='"+baseWithSlash, -1)
|
||||
content = strings.Replace(content, " href='/", " href='"+baseWithSlash, -1)
|
||||
content = strings.Replace(content, " href=\"/", " href=\""+baseWithSlash, -1)
|
||||
content = strings.Replace(content, baseWithoutTrailingSlash+"//", baseWithSlash, -1)
|
||||
s.Pages[i].Content = template.HTML(content)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue