permalink = helpers.URLPrep(viper.GetBool("uglyURLs"), path.Join(dir, p.Slug+"."+p.Extension()))
} else {
t := p.Source.TranslationBaseName()
- permalink = helpers.URLPrep(viper.GetBool("uglyURLs"), path.Join(dir, helpers.ReplaceExtension(strings.TrimSpace(t), p.Extension())))
+ permalink = helpers.URLPrep(viper.GetBool("uglyURLs"), path.Join(dir, (strings.TrimSpace(t)+"."+p.Extension())))
}
}
outfile = strings.TrimSpace(p.Slug) + "." + p.Extension()
} else {
// Fall back to filename
- outfile = helpers.ReplaceExtension(p.Source.TranslationBaseName(), p.Extension())
+ outfile = (p.Source.TranslationBaseName() + "." + p.Extension())
}
return p.addLangFilepathPrefix(filepath.Join(strings.ToLower(
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())