mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 22:21:07 +03:00
Fix aliases with uglyURLs
This commit is contained in:
parent
d6ed17c60f
commit
f720fe56db
2 changed files with 17 additions and 15 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue