[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 <title> 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>
This commit is contained in:
Arthur Detroux (ard)
2023-08-14 13:42:08 +02:00
parent 863cfc5ff1
commit 276dbdad5a
@@ -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' });