Fix aliases with uglyURLs

This commit is contained in:
Helder Pereira 2020-06-14 22:33:00 +01:00 committed by Bjørn Erik Pedersen
parent d6ed17c60f
commit f720fe56db
2 changed files with 17 additions and 15 deletions

View file

@ -338,19 +338,18 @@ func (s *Site) renderAliases() error {
if isRelative {
// Make alias relative, where "." will be on the
// same directory level as the current page.
// TODO(bep) ugly URLs doesn't seem to be supported in
// aliases, I'm not sure why not.
basePath := of.RelPermalink()
if strings.HasSuffix(basePath, "/") {
basePath = path.Join(basePath, "..")
}
basePath := path.Join(of.RelPermalink(), "..")
a = path.Join(basePath, a)
} else if f.Path != "" {
} else {
// Make sure AMP and similar doesn't clash with regular aliases.
a = path.Join(f.Path, a)
}
if s.UglyURLs && !strings.HasSuffix(a, ".html") {
a += ".html"
}
lang := p.Language().Lang
if s.h.multihost && !strings.HasPrefix(a, "/"+lang) {