From: Bjørn Erik Pedersen Date: Wed, 31 May 2017 07:57:19 +0000 (+0300) Subject: hugolib: Respect disableKinds=["sitemap"] X-Git-Tag: v0.22~35 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=69d92dc4;p=brevno-suite%2Fhugo hugolib: Respect disableKinds=["sitemap"] Fixes #3544 --- diff --git a/hugolib/config.go b/hugolib/config.go index 8847b349..e2e9f932 100644 --- a/hugolib/config.go +++ b/hugolib/config.go @@ -59,6 +59,7 @@ func LoadConfig(fs afero.Fs, relativeSourcePath, configFilename string) (*viper. } if v.IsSet("disableSitemap") { + // NOTE: Do not remove this until Hugo 0.24, ERROR in 0.23. helpers.Deprecated("site config", "disableSitemap", "Use disableKinds= [\"sitemap\"]", false) } diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go index 6e7034bd..1091660e 100644 --- a/hugolib/hugo_sites.go +++ b/hugolib/hugo_sites.go @@ -269,6 +269,17 @@ func (h *HugoSites) renderCrossSitesArtifacts() error { return nil } + sitemapEnabled := false + for _, s := range h.Sites { + if s.isEnabled(kindSitemap) { + sitemapEnabled = true + } + } + + if !sitemapEnabled { + return nil + } + // TODO(bep) DRY sitemapDefault := parseSitemap(h.Cfg.GetStringMap("sitemap"))