This commit is contained in:
Jesús
2020-02-04 21:03:27 -05:00
parent 8ce1426785
commit edcc28d056
8 changed files with 68 additions and 50 deletions

View File

@@ -54,6 +54,7 @@ def format_date(date):
tz = "-00:00"
return date.strftime("%Y-%m-%dT%H:%M:%S") + tz
class SitemapGenerator(object):
def __init__(self, context, settings, path, theme, output_path, *null):
@@ -63,7 +64,6 @@ class SitemapGenerator(object):
self.now = datetime.now()
self.siteurl = settings.get('SITEURL')
self.default_timezone = settings.get('TIMEZONE', 'UTC')
self.timezone = getattr(self, 'timezone', self.default_timezone)
self.timezone = timezone(self.timezone)
@@ -103,7 +103,7 @@ class SitemapGenerator(object):
valid_keys = ('articles', 'indexes', 'pages')
valid_chfreqs = ('always', 'hourly', 'daily', 'weekly', 'monthly',
'yearly', 'never')
'yearly', 'never')
if isinstance(pris, dict):
# We use items for Py3k compat. .iteritems() otherwise
@@ -137,7 +137,7 @@ class SitemapGenerator(object):
if getattr(page, 'status', 'published') != 'published':
return
if getattr(page, 'private', 'False') == 'True':
return
@@ -169,7 +169,7 @@ class SitemapGenerator(object):
pageurl = '' if page.url == 'index.html' else page.url
#Exclude URLs from the sitemap:
# Exclude URLs from the sitemap:
if self.format == 'xml':
flag = False
for regstr in self.sitemapExclude:
@@ -206,9 +206,9 @@ class SitemapGenerator(object):
path = os.path.join(self.output_path, 'sitemap.{0}'.format(self.format))
pages = self.context['pages'] + self.context['articles'] \
+ [ c for (c, a) in self.context['categories']] \
+ [ t for (t, a) in self.context['tags']] \
+ [ a for (a, b) in self.context['authors']]
+ [c for (c, a) in self.context['categories']] \
+ [t for (t, a) in self.context['tags']] \
+ [a for (a, b) in self.context['authors']]
self.set_url_wrappers_modification_date(self.context['categories'])
self.set_url_wrappers_modification_date(self.context['tags'])