[FIX] website: fix sitemap for multi website if more than one page

Template "sitemap_index_xml":
    <loc><t t-esc="url_root"/>sitemap-<t t-esc="page"/>.xml</loc>
should be:
    <loc><t t-esc="url_root"/>sitemap-<t t-esc="website_id"/>-<t t-esc="page"/>.xml</loc>

The fix in python is not elegant but allow to fix without -u of website.
This commit is contained in:
Jeremy Kersten
2017-02-24 20:52:22 +01:00
parent 1f77c2d681
commit 2bf6eab609
+4 -1
View File
@@ -151,9 +151,12 @@ class Website(openerp.addons.web.controllers.main.Home):
# rename the -id-page.xml => -id.xml
ira.write(cr, uid, last, dict(url="/sitemap-%d.xml" % current_website.id, name="/sitemap-%d.xml" % current_website.id), context=context)
else:
# TODO: in master/saas-15, move current_website_id in template directly
pages_with_website = map(lambda p: "%d-%d" % (current_website.id, p), range(1, pages + 1))
# Sitemaps must be split in several smaller files with a sitemap index
content = iuv.render(cr, uid, 'website.sitemap_index_xml', dict(
pages=range(1, pages + 1),
pages=pages_with_website,
url_root=request.httprequest.url_root,
), context=context)
create_sitemap('/sitemap-%d.xml' % current_website.id, content)