Browse Source

Fix sitemap with disabled pages (fix #206)

Recommendation in pelican < 3.4 was to disable pages using
a False boolean (http://docs.getpelican.com/en/3.3.0/settings.html#basic-settings)
It's now recommended to use '' and the sitemap plugins tries to
join paths using those variables, which won't work with a bool.
This checks that we have a truthy value before joining.
Keats 9 years ago
parent
commit
fa687ef8d1
1 changed files with 4 additions and 0 deletions
  1. 4 0
      sitemap/sitemap.py

+ 4 - 0
sitemap/sitemap.py

@@ -134,6 +134,10 @@ class SitemapGenerator(object):
         if getattr(page, 'status', 'published') != 'published':
             return
 
+        # We can disable categories/authors/etc by using False instead of ''
+        if not page.save_as:
+            return
+
         page_path = os.path.join(self.output_path, page.save_as)
         if not os.path.exists(page_path):
             return