[FIX] website: fix metadata open graph site name
This commit fixes the 'og:site_name' metadata, which previously defaulted to the company name (see [1]), causing issues for multi-site setups. Now, the metadata actually uses the site name. Steps to reproduce: - Navigate to any page - Right-click and select "View Page Source" - In the <head> section, observe the meta property "og:site_name" set to "MyCompany". [1]: https://github.com/odoo/odoo/commit/156955de6b4e6288ac606d29b843081842154eff opw-3791082 closes odoo/odoo#161123 X-original-commit: 24ea3ca4b12f8dd4103a650436a144e776b81d83 Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
@@ -46,6 +46,7 @@ class SeoMetadata(models.AbstractModel):
|
||||
self.ensure_one()
|
||||
company = request.website.company_id.sudo()
|
||||
title = (request.website or company).name
|
||||
site_name = title
|
||||
if 'name' in self:
|
||||
title = '%s | %s' % (self.name, title)
|
||||
|
||||
@@ -55,7 +56,7 @@ class SeoMetadata(models.AbstractModel):
|
||||
default_opengraph = {
|
||||
'og:type': 'website',
|
||||
'og:title': title,
|
||||
'og:site_name': company.name,
|
||||
'og:site_name': site_name,
|
||||
'og:url': url_join(request.httprequest.url_root, url_for(request.httprequest.path)),
|
||||
'og:image': request.website.image_url(request.website, img_field),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user