diff --git a/cgi-bin/webnotes/utils/sitemap.py b/cgi-bin/webnotes/utils/sitemap.py index fd489f6d64..916aaa1eb1 100644 --- a/cgi-bin/webnotes/utils/sitemap.py +++ b/cgi-bin/webnotes/utils/sitemap.py @@ -16,19 +16,24 @@ def generate_xml(conn, site_prefix): max_items = 1000 site_map = '' + page_list = [] if site_prefix: - # list of all Guest pages (static content) - for r in conn.sql("SELECT name, modified FROM tabPage WHERE ifnull(publish,0)=1 ORDER BY modified DESC"): - page_url = site_prefix + '#!' + urllib.quote(r[0]) - site_map += link_xml % (page_url, r[1].strftime('%Y-%m-%d')) - # list of all Records that are viewable by guests (Blogs, Articles etc) try: from startup.event_handlers import get_sitemap_items for i in get_sitemap_items(site_prefix): site_map += link_xml % (i[0], i[1]) + ('/' in i[0]) and page_list.append(i[0].split('/')[1]) or i[0] except ImportError, e: pass + # list of all Guest pages (static content) + for r in conn.sql("SELECT name, modified FROM tabPage WHERE ifnull(publish,0)=1 ORDER BY modified DESC"): + #check for double + if r[0] not in page_list: + page_url = site_prefix + '#!' + urllib.quote(r[0]) + site_map += link_xml % (page_url, r[1].strftime('%Y-%m-%d')) + + return frame_xml % site_map diff --git a/cgi-bin/webnotes/widgets/page_body.py b/cgi-bin/webnotes/widgets/page_body.py index f221511209..8e19ad0716 100644 --- a/cgi-bin/webnotes/widgets/page_body.py +++ b/cgi-bin/webnotes/widgets/page_body.py @@ -90,12 +90,10 @@ def scrub_ids(content): return content -# -# load the page content and meta tags -# def get_page_content(page): """ - Gets the HTML content from `static_content` or `content` property of a `Page` + Gets the HTML content from `static_content` or `content` property of a `Page` + and loads it in global `page_properties` """ from webnotes.model.code import get_code from webnotes.model.doc import Document @@ -125,9 +123,6 @@ def get_page_content(page): except: pass -# -# load metatags -# def load_page_metatags(doc): global page_properties @@ -143,25 +138,6 @@ def load_page_metatags(doc): page_properties['add_in_head'] = getattr(startup, 'add_in_head', '') page_properties['add_in_body'] = getattr(startup, 'add_in_body', '') -# -# load the form as page (deprecated) -# -def get_doc_content(dt, dn): - """ - Gets the HTML content of a document record by using the overridden or standard :method: `doclist.to_html` - """ - import webnotes.model.code - - if dt in webnotes.user.get_read_list(): - # generate HTML - do = webnotes.model.code.get_obj(dt, dn, with_children = 1) - if hasattr(do, 'to_html'): - return dn, do.to_html() - else: - import webnotes.model.doclist - return dn, webnotes.model.doclist.to_html(do.doclist) - else: - return 'Forbidden - 404', '