summaryrefslogtreecommitdiffstats
path: root/helpers/url.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-12-29 09:37:37 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-12-29 09:37:37 +0100
commit72903be587e9c4e3644f60b11e26238ec03da2db (patch)
treec59cc06465771502f2f7669a3e593f567af18b2c /helpers/url.go
parent1c114d539b0755724443fe28c90b12fe2a19085a (diff)
commands: Make sure all language homes are always re-rendered in fast render mode
Fixes #4125
Diffstat (limited to 'helpers/url.go')
-rw-r--r--helpers/url.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/helpers/url.go b/helpers/url.go
index 9c1a643cc..8faefeefa 100644
--- a/helpers/url.go
+++ b/helpers/url.go
@@ -215,6 +215,23 @@ func (p *PathSpec) getLanguagePrefix() string {
return currentLang
}
+// GetLangSubDir returns the given language's subdir if needed.
+func (p *PathSpec) GetLangSubDir(lang string) string {
+ if !p.multilingual {
+ return ""
+ }
+
+ if p.languages.IsMultihost() {
+ return ""
+ }
+
+ if lang == "" || (lang == p.defaultContentLanguage && !p.defaultContentLanguageInSubdir) {
+ return ""
+ }
+
+ return lang
+}
+
// IsAbsURL determines whether the given path points to an absolute URL.
func IsAbsURL(path string) bool {
url, err := url.Parse(path)