소스 검색

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 10 년 전
부모
커밋
fa687ef8d1
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  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