From 5794a265b41ffdeebfd8485eecf65cf4088d49d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 10 May 2017 20:00:08 +0200 Subject: [PATCH] commands, hugolib: Deprecate disable404, disableRSS, disableSitemap, disableRobotsTXT Use disableKinds instead. Fixes #3345 --- commands/hugo.go | 13 +++++++++++++ hugolib/config.go | 17 +++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/commands/hugo.go b/commands/hugo.go index 4c12ccc7d..b7bc863a4 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -467,6 +467,19 @@ func (c *commandeer) initializeFlags(cmd *cobra.Command) { "noChmod", } + // Remove these in Hugo 0.23. + if flagChanged(cmd.Flags(), "disable404") { + helpers.Deprecated("command line", "--disable404", "Use --disableKinds=404", false) + } + + if flagChanged(cmd.Flags(), "disableRSS") { + helpers.Deprecated("command line", "--disableRSS", "Use --disableKinds=RSS", false) + } + + if flagChanged(cmd.Flags(), "disableSitemap") { + helpers.Deprecated("command line", "--disableSitemap", "Use --disableKinds=sitemap", false) + } + for _, key := range persFlagKeys { c.setValueFromFlag(cmd.PersistentFlags(), key) } diff --git a/hugolib/config.go b/hugolib/config.go index 50e742bc2..8847b3495 100644 --- a/hugolib/config.go +++ b/hugolib/config.go @@ -49,6 +49,23 @@ func LoadConfig(fs afero.Fs, relativeSourcePath, configFilename string) (*viper. v.RegisterAlias("indexes", "taxonomies") + // Remove these in Hugo 0.23. + if v.IsSet("disable404") { + helpers.Deprecated("site config", "disable404", "Use disableKinds=[\"404\"]", false) + } + + if v.IsSet("disableRSS") { + helpers.Deprecated("site config", "disableRSS", "Use disableKinds=[\"RSS\"]", false) + } + + if v.IsSet("disableSitemap") { + helpers.Deprecated("site config", "disableSitemap", "Use disableKinds= [\"sitemap\"]", false) + } + + if v.IsSet("disableRobotsTXT") { + helpers.Deprecated("site config", "disableRobotsTXT", "Use disableKinds= [\"robotsTXT\"]", false) + } + loadDefaultSettingsFor(v) return v, nil