瀏覽代碼

Adds ability to mark individual pages as private.

Michael Lissner 8 年之前
父節點
當前提交
fd37bd5115
共有 2 個文件被更改,包括 6 次插入0 次删除
  1. 3 0
      sitemap/Readme.rst
  2. 3 0
      sitemap/sitemap.py

+ 3 - 0
sitemap/Readme.rst

@@ -44,6 +44,9 @@ use the following ``SITEMAP`` setting.
 If a key is missing or a value is incorrect, it will be replaced with the
 default value.
 
+You can also exclude an individual URL by adding metadata to it setting ``private``
+to ``True``.
+
 The sitemap is saved in ``<output_path>/sitemap.<format>``.
 
 .. note::

+ 3 - 0
sitemap/sitemap.py

@@ -137,6 +137,9 @@ class SitemapGenerator(object):
 
         if getattr(page, 'status', 'published') != 'published':
             return
+           
+        if getattr(page, 'private', 'False') == 'True':
+            return
 
         # We can disable categories/authors/etc by using False instead of ''
         if not page.save_as: