hugolib: Make sure everything ends up in its lang root in multihost mode

Fixes #4105
This commit is contained in:
Bjørn Erik Pedersen 2017-11-20 10:34:30 +01:00
parent 118b83d74b
commit 089fe49309
5 changed files with 181 additions and 144 deletions

View file

@ -16,6 +16,7 @@ package hugolib
import (
"fmt"
"path"
"strings"
"sync"
"github.com/gohugoio/hugo/helpers"
@ -380,6 +381,13 @@ func (s *Site) renderAliases() error {
a = path.Join(a, f.Path)
}
lang := p.Lang()
if s.owner.multihost && !strings.HasPrefix(a, "/"+lang) {
// These need to be in its language root.
a = path.Join(lang, a)
}
if err := s.writeDestAlias(a, plink, p); err != nil {
return err
}