diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/sourceSpec.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/sourceSpec.go b/source/sourceSpec.go index 74a754a26..e40010162 100644 --- a/source/sourceSpec.go +++ b/source/sourceSpec.go @@ -35,6 +35,7 @@ type SourceSpec struct { Languages map[string]interface{} DefaultContentLanguage string + DisabledLanguages map[string]bool } // NewSourceSpec initializes SourceSpec using languages from a given configuration. @@ -42,6 +43,12 @@ func NewSourceSpec(cfg config.Provider, fs *hugofs.Fs) *SourceSpec { defaultLang := cfg.GetString("defaultContentLanguage") languages := cfg.GetStringMap("languages") + disabledLangsSet := make(map[string]bool) + + for _, disabledLang := range cfg.GetStringSlice("disableLanguages") { + disabledLangsSet[disabledLang] = true + } + if len(languages) == 0 { l := helpers.NewDefaultLanguage(cfg) languages[l.Lang] = l @@ -62,7 +69,7 @@ func NewSourceSpec(cfg config.Provider, fs *hugofs.Fs) *SourceSpec { } } - return &SourceSpec{ignoreFilesRe: regexps, Cfg: cfg, Fs: fs, Languages: languages, DefaultContentLanguage: defaultLang} + return &SourceSpec{ignoreFilesRe: regexps, Cfg: cfg, Fs: fs, Languages: languages, DefaultContentLanguage: defaultLang, DisabledLanguages: disabledLangsSet} } func (s *SourceSpec) IgnoreFile(filename string) bool { |