您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930
  1. # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
  2. # MIT License. See license.txt
  3. from __future__ import unicode_literals
  4. import urllib
  5. import webnotes
  6. from webnotes.utils import get_request_site_address
  7. no_cache = 1
  8. no_sitemap = 1
  9. base_template_path = "templates/pages/sitemap.xml"
  10. def get_context(context):
  11. """generate the sitemap XML"""
  12. host = get_request_site_address()
  13. links = []
  14. for l in webnotes.conn.sql("""select `tabWebsite Sitemap`.page_name, `tabWebsite Sitemap`.lastmod
  15. from `tabWebsite Sitemap`, `tabWebsite Sitemap Config`
  16. where
  17. `tabWebsite Sitemap`.website_sitemap_config = `tabWebsite Sitemap Config`.name
  18. and ifnull(`tabWebsite Sitemap Config`.no_sitemap, 0)=0""",
  19. as_dict=True):
  20. links.append({
  21. "loc": urllib.basejoin(host, urllib.quote(l.page_name.encode("utf-8"))),
  22. "lastmod": l.lastmod
  23. })
  24. return {"links":links}