Skip to Content
Menu
This question has been flagged
3 Replies
2471 Views

If you have eCommerce Categories  toggled on in the shop, every category page has the same default title tag of:

Shop | MyCompany

I would like to change it so that the title is:

%CATEGORY NAME% | MyCompany

Could someone point me in the right direction?  I tried overriding _get_website_meta() but that seems to only handle the opengraph and facebook tags?

Avatar
Discard
Best Answer

change additional_title of products template ​
https://github.com/odoo/odoo/blob/12.0/addons/website_sale/views/templates.xml#L187

​<t t-if="category">
    <t t-set="additional_title"><t t-esc="category.name"/></t>
</t>
<t t-else="">
    <t t-set="additional_title">Shop</t>
</t>

Avatar
Discard
Author

Thank you, I achieved similar results by modifying the title tag in web.layout. Your solution is much cleaner.

Author Best Answer

Ultimately I ended up with this piece of code modifying website_sale.products:

<t t-if="category and category.parent_id" t-set="additional_title"><t t-esc="category.parent_id.name + ' - ' + category.name"/></t>
<t t-elif="category" t-set="additional_title"><t t-esc="category.name"/></t>
<t t-else="" t-set="additional_title">Shop</t>
Avatar
Discard