-
- Downloads
[FIX] website: use correct url code to get canonical url
Before this commit, we would compare a lang `code` (used in context) and a lang `url_code`. For languages where those 2 are differents, the `if` condition would always be falsy, making the canonical URL impossible to be reached. Technically, this condition is used to get the translated name of records to later construct the canonical URL. Since the canonical URL will be incorrect and unreachable, the whole system to tell search engine/crawler about translation won't work since no `alternate/hreflang`[1] will be set in the DOM. [1] see https://developers.google.com/search/docs/advanced/crawling/localized-versions -------- Technical explanation: - italian language `code` = `it_IT`, `url_code` = `it` - belgian french language `code` = `fr_BE`, `url_code` = `fr_BE` Install those languages on website as secondary languages. Translate blog `Travel` to `Voyager` in french and `Viaggi` in italian. Visiting `/fr_BE/blog/travel-1/post/post-1` will redirect to `/fr_BE/blog/voyager-1/post/post-1` as it should, and the canonical URL will be set to that same URL. Visiting `/it/blog/travel-1/post/post-1` will redirect to `/it/blog/voyager-1/post/post-1` as it should, but the canonical URL will be set to `/it/blog/travel-1/post/post-1`. opw-2486918 closes odoo/odoo#69503 Signed-off-by:Romain Derie <rdeodoo@users.noreply.github.com>
Showing
- addons/test_website/controllers/main.py 4 additions, 0 deletionsaddons/test_website/controllers/main.py
- addons/test_website/tests/test_is_multilang.py 45 additions, 0 deletionsaddons/test_website/tests/test_is_multilang.py
- addons/website/models/website.py 2 additions, 2 deletionsaddons/website/models/website.py
Loading
Please register or sign in to comment