Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only offer active homepage locales on / site root #15010

Open
janbrasna opened this issue Aug 26, 2024 · 2 comments · May be fixed by #15025
Open

Only offer active homepage locales on / site root #15010

janbrasna opened this issue Aug 26, 2024 · 2 comments · May be fixed by #15025
Labels
Bug 🐛 Something's not working the way it should

Comments

@janbrasna
Copy link
Contributor

janbrasna commented Aug 26, 2024

Description

Originally posted by @janbrasna in #15007 (comment):

"The offered languages, esp. from the bot/baseline root page, should all be working. I've found some in prod that link to 404 — e.g. Tadjik (Тоҷикӣ) /tg is being offered there, but not working."

Steps to reproduce

Open https://www.mozilla.org/ with Accept-Language header empty to get to the locale selection page (i.e. this from crawlers PoV), and check all the links work.

(Alternative hreflangs meta for / home follows the same pattern, and differs for the list of hreflangs for /en home — TODO: investigate why the active locales are assessed with different results here… Generated sitemaps seem unaffected by this.)

Expected result

Only working locales linked.

Actual result

https://www.mozilla.org/ach › default fallback
https://www.mozilla.org/lo › /en-US/lo/ 404
https://www.mozilla.org/mk › default fallback
https://www.mozilla.org/km › default fallback
https://www.mozilla.org/tg › /en-US/tg/ 404
https://www.mozilla.org/tl › default fallback

Environment

Overrides with googlebot UA string, empty Accept-Locale etc.

@janbrasna janbrasna added the Bug 🐛 Something's not working the way it should label Aug 26, 2024
@janbrasna janbrasna changed the title Only link to working locales from canonical meta and / site root Only link to working locales from bot content and / site root Aug 27, 2024
@janbrasna
Copy link
Contributor Author

For now it seems that the active_locales for root page (that are then offered as the languages available for the home page translation) are taken from metadata/404.json instead of say e.g. metadata/mozorg/home.json — either by the fact it's the first file in the folder, or that's the actual page that serves the root?

Compare ./manage.py active_locales mozorg/home (expected locales)
to ./manage.py active_locales 404 (that are in reality used for the home root links)

Basically none of the root language selection gets filtered to PROD_LANGUAGES or DEV_LANGUAGES, only to locale map from product-details, otherwise anything that's in the metadata json as active_locale gets exposed all the way through.

@janbrasna
Copy link
Contributor Author

Actually not only there are disabled languages being offered. There are also a handful missing: https://www.textcompare.org/?id=66cf6c8bba091793598346ea

Screenshot 2024-08-28 at 20 30 57

(full diff in the link, but basically some European and Asian languages like az, bg, et, gu, hy, lt, ta, ur missing.)

  1. So for this root page to correctly reflect the available locales for homepage (i.e. those that would be alternate hreflangs for /en-US/ and are correctly offered there), this root has to list active_locales not for its request, but for mozorg/home.ftl instead.
  2. Also to avoid providing broken links in case there are active_locales that are however not allowed in PROD_LANGUAGES, a filter to only allow PROD_LANGUAGES needs to be added.

@janbrasna janbrasna changed the title Only link to working locales from bot content and / site root Only offer active homepage locales on / site root Aug 28, 2024
@janbrasna janbrasna linked a pull request Aug 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 Something's not working the way it should
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@janbrasna and others