You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

28 rivejä
736 B

  1. # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
  2. # MIT License. See license.txt
  3. from __future__ import unicode_literals
  4. import urllib
  5. import webnotes
  6. import webnotes.webutils
  7. from webnotes.utils import nowdate
  8. def generate(domain):
  9. """generate the sitemap XML"""
  10. frame_xml = """<?xml version="1.0" encoding="UTF-8"?>
  11. <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">%s
  12. </urlset>"""
  13. link_xml = """\n<url><loc>%s</loc><lastmod>%s</lastmod></url>"""
  14. site_map = ""
  15. if domain:
  16. today = nowdate()
  17. for page_name, page_options in webnotes.webutils.get_website_sitemap().items():
  18. url = urllib.basejoin(domain, urllib.quote(page_name))
  19. site_map += link_xml % (url, today)
  20. return frame_xml % site_map