Include last modified date in sitemap

This commit is contained in:
Magnus Hagander
2012-01-14 16:55:53 +01:00
parent ad895a7661
commit 78ab264578
4 changed files with 16 additions and 10 deletions

View File

@ -138,8 +138,10 @@ def sitemap(request):
pages+=1
x.startElement('url', {})
x.add_xml_element('loc', 'http://www.postgresql.org/%s' % urllib.quote(p[0]))
if p[1]:
if len(p) > 1 and p[1]:
x.add_xml_element('priority', unicode(p[1]))
if len(p) > 2 and p[2]:
x.add_xml_element('lastmod', p[2].isoformat() + "Z")
x.endElement('url')
x.endElement('urlset')
x.endDocument()