handle non relate urls in absolute_url filter

This commit is contained in:
facundoolano 2024-03-15 17:50:31 -03:00
parent 9176c035e7
commit d28b97e7cb

View file

@ -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)
})