Bläddra i källkod

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

sitemap: Add ability to mark individual pages as private
Justin Mayer 7 år sedan
förälder
incheckning
76a8be9978
2 ändrade filer med 6 tillägg och 0 borttagningar
  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: