[FIX] website: don't show website info page in sitemap if disabled

This commit is simply conditionning the presence of the /website/info
page in the sitemap so it's removed from it if you disable/remove the
website info view.
It will help SEO wise to not have error page in it.

Also note that it has always been in sitemap, even if marked
excplicitely since [1].

[1]: https://github.com/odoo/odoo/commit/e19227d3ba9c9296bfc0c221ac70a863a571b9a6#diff-d41b2dc5ff6fd6a303373f86e1af97d055db315ccc431749b4ffac1488dea119L200

opw-3255831

closes odoo/odoo#121226

X-original-commit: b4ae4a0f8b592a07537f051d4a8a4152ac7df9c6
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
Romain Derie
2023-05-12 20:52:08 +02:00
parent dba7056c71
commit c3ccfbe98d
+13 -1
View File
@@ -296,7 +296,19 @@ class Website(Home):
response.headers['Cache-Control'] = 'public, max-age=%s' % http.STATIC_CACHE_LONG
return response
@http.route('/website/info', type='http', auth="public", website=True, sitemap=True)
def sitemap_website_info(env, rule, qs):
website = env['website'].get_current_website()
if not (
website.viewref('website.website_info', False).active
and website.viewref('website.show_website_info', False).active
):
# avoid 404 or blank page in sitemap
return False
if not qs or qs.lower() in '/website/info':
yield {'loc': '/website/info'}
@http.route('/website/info', type='http', auth="public", website=True, sitemap=sitemap_website_info)
def website_info(self, **kwargs):
Module = request.env['ir.module.module'].sudo()
apps = Module.search([('state', '=', 'installed'), ('application', '=', True)])