hugolib, output: Handle aliases for all HTML formats

This commit is contained in:
Bjørn Erik Pedersen
2017-03-24 11:25:25 +01:00
parent 0c4701f0ef
commit 87188496fb
6 changed files with 77 additions and 22 deletions

View File

@@ -88,18 +88,6 @@ func (s *Site) publishDestAlias(allowRoot bool, path, permalink string, p *Page)
isXHTML := strings.HasSuffix(path, ".xhtml")
if s.Info.relativeURLs {
// convert `permalink` into URI relative to location of `path`
baseURL := helpers.SanitizeURLKeepTrailingSlash(s.Cfg.GetString("baseURL"))
if strings.HasPrefix(permalink, baseURL) {
permalink = "/" + strings.TrimPrefix(permalink, baseURL)
}
permalink, err = helpers.GetRelativePath(permalink, path)
if err != nil {
s.Log.ERROR.Println("Failed to make a RelativeURL alias:", path, "redirecting to", permalink)
}
permalink = filepath.ToSlash(permalink)
}
s.Log.DEBUG.Println("creating alias:", path, "redirecting to", permalink)
targetPath, err := handler.targetPathAlias(path)