diff options
author | Helder Pereira <[email protected]> | 2020-06-14 22:33:00 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2020-06-15 12:19:59 +0200 |
commit | f720fe56db9e064d10b86d98e7bbd40fb1c8489f (patch) | |
tree | a35e72e96417a981846a629e713699e2f3ce0df2 /hugolib/site_render.go | |
parent | d6ed17c60fd13c933347110c720afa09e04df1c8 (diff) | |
download | hugo-f720fe56db9e064d10b86d98e7bbd40fb1c8489f.tar.gz hugo-f720fe56db9e064d10b86d98e7bbd40fb1c8489f.zip |
Fix aliases with uglyURLs
Diffstat (limited to 'hugolib/site_render.go')
-rw-r--r-- | hugolib/site_render.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/hugolib/site_render.go b/hugolib/site_render.go index 5377babef..1d397dafa 100644 --- a/hugolib/site_render.go +++ b/hugolib/site_render.go @@ -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) { |