Skip to content

Commit 5794a26

Browse files
committed
commands, hugolib: Deprecate disable404, disableRSS, disableSitemap, disableRobotsTXT
Use disableKinds instead. Fixes #3345
1 parent ebf677a commit 5794a26

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

‎commands/hugo.go‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,19 @@ func (c *commandeer) initializeFlags(cmd *cobra.Command) {
467467
"noChmod",
468468
}
469469

470+
// Remove these in Hugo 0.23.
471+
if flagChanged(cmd.Flags(), "disable404") {
472+
helpers.Deprecated("command line", "--disable404", "Use --disableKinds=404", false)
473+
}
474+
475+
if flagChanged(cmd.Flags(), "disableRSS") {
476+
helpers.Deprecated("command line", "--disableRSS", "Use --disableKinds=RSS", false)
477+
}
478+
479+
if flagChanged(cmd.Flags(), "disableSitemap") {
480+
helpers.Deprecated("command line", "--disableSitemap", "Use --disableKinds=sitemap", false)
481+
}
482+
470483
for _, key := range persFlagKeys {
471484
c.setValueFromFlag(cmd.PersistentFlags(), key)
472485
}

‎hugolib/config.go‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,23 @@ func LoadConfig(fs afero.Fs, relativeSourcePath, configFilename string) (*viper.
4949

5050
v.RegisterAlias("indexes", "taxonomies")
5151

52+
// Remove these in Hugo 0.23.
53+
if v.IsSet("disable404") {
54+
helpers.Deprecated("site config", "disable404", "Use disableKinds=[\"404\"]", false)
55+
}
56+
57+
if v.IsSet("disableRSS") {
58+
helpers.Deprecated("site config", "disableRSS", "Use disableKinds=[\"RSS\"]", false)
59+
}
60+
61+
if v.IsSet("disableSitemap") {
62+
helpers.Deprecated("site config", "disableSitemap", "Use disableKinds= [\"sitemap\"]", false)
63+
}
64+
65+
if v.IsSet("disableRobotsTXT") {
66+
helpers.Deprecated("site config", "disableRobotsTXT", "Use disableKinds= [\"robotsTXT\"]", false)
67+
}
68+
5269
loadDefaultSettingsFor(v)
5370

5471
return v, nil

0 commit comments

Comments
 (0)