mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-16 20:53:59 +02:00
Add a way to disable one or more languages
This commit adds a new config setting: ```toml disableLanguages = ["fr"] ``` If this is a multilingual site: * No site for the French language will be created * French content pages will be ignored/not read * The French language configuration (menus etc.) will also be ignored This makes it possible to start translating new languages and turn it on when you're happy etc. Fixes #4297 Fixed #4329
This commit is contained in:
@@ -31,6 +31,9 @@ type fileInfo struct {
|
||||
bundleTp bundleDirType
|
||||
source.ReadableFile
|
||||
overriddenLang string
|
||||
|
||||
// Set if the content language for this file is disabled.
|
||||
disabled bool
|
||||
}
|
||||
|
||||
func (fi *fileInfo) Lang() string {
|
||||
@@ -60,6 +63,9 @@ func newFileInfo(sp *source.SourceSpec, baseDir, filename string, fi os.FileInfo
|
||||
ReadableFile: baseFi,
|
||||
}
|
||||
|
||||
lang := f.Lang()
|
||||
f.disabled = lang != "" && sp.DisabledLanguages[lang]
|
||||
|
||||
return f
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user