diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-08-04 21:41:30 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-09-06 18:32:17 +0300 |
commit | d572071784f54f083ab7918c5029d2f88bc64016 (patch) | |
tree | 83a49ebdf5b3cdd5ba0df27f5437b73691a5229a /target | |
parent | f0b91852ea5e5d3ec985286751f17e34bfc6c7bc (diff) |
Redirect to main language from root
See #2312
See #2309
Diffstat (limited to 'target')
-rw-r--r-- | target/htmlredirect.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/target/htmlredirect.go b/target/htmlredirect.go index d8eac943c..81051589a 100644 --- a/target/htmlredirect.go +++ b/target/htmlredirect.go @@ -45,6 +45,7 @@ type AliasPublisher interface { type HTMLRedirectAlias struct { PublishDir string Templates *template.Template + AllowRoot bool // for the language redirects } func (h *HTMLRedirectAlias) Translate(alias string) (aliasPath string, err error) { @@ -56,7 +57,7 @@ func (h *HTMLRedirectAlias) Translate(alias string) (aliasPath string, err error alias = filepath.Clean(alias) components := strings.Split(alias, helpers.FilePathSeparator) - if alias == helpers.FilePathSeparator { + if !h.AllowRoot && alias == helpers.FilePathSeparator { return "", fmt.Errorf("Alias \"%s\" resolves to website root directory", originalAlias) } |