Explorar el Código

Merge pull request #859 from mlissner/adds-private-var

sitemap: Add ability to mark individual pages as private
Justin Mayer hace 7 años
padre
commit
76a8be9978
Se han modificado 2 ficheros con 6 adiciones y 0 borrados
  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: