mirror of
https://github.com/facundoolano/jorge.git
synced 2024-11-16 07:47:40 +01:00
handle non relate urls in absolute_url filter
This commit is contained in:
parent
9176c035e7
commit
d28b97e7cb
1 changed files with 7 additions and 0 deletions
|
@ -53,6 +53,13 @@ func loadJekyllFilters(e *liquid.Engine, siteUrl string, includesDir string) {
|
|||
})
|
||||
|
||||
e.RegisterFilter("absolute_url", func(path string) (string, error) {
|
||||
parsed, err := url.Parse(path)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if parsed.IsAbs() {
|
||||
return path, nil
|
||||
}
|
||||
return url.JoinPath(siteUrl, path)
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue