commands, hugolib: Deprecate disable404, disableRSS, disableSitemap, disableRobotsTXT

Use disableKinds instead.

Fixes #3345
This commit is contained in:
Bjørn Erik Pedersen 2017-05-10 20:00:08 +02:00
parent ebf677a583
commit 5794a265b4
2 changed files with 30 additions and 0 deletions

View file

@ -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)
}

View file

@ -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