Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/file.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/file.go b/source/file.go
index 7e3e7d7c4..c309bbd03 100644
--- a/source/file.go
+++ b/source/file.go
@@ -126,11 +126,14 @@ func NewFile(relpath string) *File {
f.ext = strings.TrimPrefix(filepath.Ext(f.LogicalName()), ".")
f.baseName = helpers.Filename(f.LogicalName())
- f.lang = strings.TrimPrefix(filepath.Ext(f.baseName), ".")
- if f.lang == "" {
+ lang := strings.TrimPrefix(filepath.Ext(f.baseName), ".")
+ if _, ok := viper.GetStringMap("languages")[lang]; lang == "" || !ok {
f.lang = viper.GetString("defaultContentLanguage")
+ f.translationBaseName = f.baseName
+ } else {
+ f.lang = lang
+ f.translationBaseName = helpers.Filename(f.baseName)
}
- f.translationBaseName = helpers.Filename(f.baseName)
f.section = helpers.GuessSection(f.Dir())
f.uniqueID = helpers.Md5String(f.LogicalName())