diff options
author | Bjørn Erik Pedersen <[email protected]> | 2018-01-25 17:03:29 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2018-01-26 14:04:14 +0100 |
commit | 6413559f7575e2653d76227a8037a7edbaae82aa (patch) | |
tree | 4b2d2be2943e1f7c37d6aa09937bec4391c1e678 /hugolib/fileInfo.go | |
parent | 322c567220aa4123a5d707629c1bebd375599912 (diff) | |
download | hugo-6413559f7575e2653d76227a8037a7edbaae82aa.tar.gz hugo-6413559f7575e2653d76227a8037a7edbaae82aa.zip |
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
Diffstat (limited to 'hugolib/fileInfo.go')
-rw-r--r-- | hugolib/fileInfo.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/hugolib/fileInfo.go b/hugolib/fileInfo.go index 582d2be8c..b146aede9 100644 --- a/hugolib/fileInfo.go +++ b/hugolib/fileInfo.go @@ -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 } |