From 276dbdad5ac2cf2f60d73d3d74c1d6c7028aa87b Mon Sep 17 00:00:00 2001 From: "Arthur Detroux (ard)" Date: Fri, 4 Aug 2023 15:38:24 +0000 Subject: [PATCH] [FIX] website: properly check for title in SEO dialog Commit [1] adapted the SEO dialog to OWL and to the move of the website in the backend. While doing so, it omitted checking for the default title when validating whether a keyword was contained in the page's title. In [15.0] the way this was checked was through a simple look through the page's tag. However, in this commit, we do not look through the HTML, rather we use the metadata "default_title". [1]: https://github.com/odoo/odoo/commit/ac55f2bb113ecf7c774fe6e96d28e716184a97d1 [15.0]: https://github.com/odoo/odoo/blob/8deeabdbfbee20289d79151fa2821ce04585d0bd/addons/website/static/src/js/menu/seo.js#L233C16-L233C45 opw-3435547 closes odoo/odoo#131809 X-original-commit: ee200b4dd97d9725c69d6f8da427ce81eb6d0e8e Signed-off-by: Benoit Socias (bso) <bso@odoo.com> --- addons/website/static/src/components/dialog/seo.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/website/static/src/components/dialog/seo.js b/addons/website/static/src/components/dialog/seo.js index da690aad728..e9e7f560b22 100644 --- a/addons/website/static/src/components/dialog/seo.js +++ b/addons/website/static/src/components/dialog/seo.js @@ -16,6 +16,7 @@ const seoContext = reactive({ title: '', seoName: '', metaImage: '', + defaultTitle: '', }); class MetaImage extends Component {} @@ -172,7 +173,7 @@ class Keyword extends Component { } get usedInTitle() { - return this.isKeywordIn(this.seoContext.title); + return this.isKeywordIn(this.seoContext.title || this.seoContext.defaultTitle); } get usedInDescription() { @@ -396,6 +397,7 @@ export class OptimizeSEODialog extends Component { seoContext.description = this.getMeta({ name: 'description' }); this.previewDescription = this.env._t("The description will be generated by search engines based on page content unless you specify one."); this.defaultTitle = this.getMeta({ name: 'default_title' }); + seoContext.defaultTitle = this.defaultTitle; this.url = path; seoContext.metaImage = this.data.website_meta_og_img || this.getMeta({ property: 'og:image' });