shithub: hugo

Download patch

ref: 69d92dc49cb8ab9276ab013d427ba2d9aaf9135d
parent: d74452cfe8f69a85ec83e05481e16bebf199a5cb
author: Bjørn Erik Pedersen <[email protected]>
date: Wed May 31 06:57:19 EDT 2017

hugolib: Respect disableKinds=["sitemap"]

Fixes #3544

--- a/hugolib/config.go
+++ b/hugolib/config.go
@@ -59,6 +59,7 @@
 	}
 
 	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)
 	}
 
--- a/hugolib/hugo_sites.go
+++ b/hugolib/hugo_sites.go
@@ -269,6 +269,17 @@
 		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"))