Browse Source

[minor] [fix] hide no_cache pages in sitemap

version-14
Anand Doshi 11 years ago
parent
commit
ef6f1aafa6
2 changed files with 10 additions and 0 deletions
  1. +7
    -0
      webnotes/webutils.py
  2. +3
    -0
      website/sitemap.py

+ 7
- 0
webnotes/webutils.py View File

@@ -119,6 +119,12 @@ def build_sitemap():
sitemap = {}
config = webnotes.cache().get_value("website_sitemap_config", build_website_sitemap_config)
sitemap.update(config["pages"])
# pages
for p in config["pages"].values():
if p.get("controller"):
module = webnotes.get_module(p["controller"])
p["no_cache"] = getattr(module, "no_cache", False)

# generators
for g in config["generators"].values():
@@ -129,6 +135,7 @@ def build_sitemap():
opts = g.copy()
opts["doctype"] = module.doctype
opts["docname"] = name
opts["no_cache"] = getattr(module, "no_cache", False)
sitemap[page_name] = opts
return sitemap


+ 3
- 0
website/sitemap.py View File

@@ -21,6 +21,9 @@ def generate(domain):
today = nowdate()
for page_name, page_options in webnotes.webutils.get_website_sitemap().items():
if page_options.get("no_cache"):
continue
url = urllib.basejoin(domain, urllib.quote(page_name.encode("utf-8")))
site_map += link_xml % (url, today)


Loading…
Cancel
Save