Glossary: related terms link to the reader's language, not English (36 Turkish and German links)

Merged
LU
9d ago
+81-9

On Turkish and German term pages, some related terms sent readers to the English page although their own language has the term. For example, Paywall on a Turkish page went to /glossary/english/paywall/ instead of the Turkish "Ödeme Duvarı (Paywall)".

The cause is the related-terms lookup, which finds a translated page only by the English name in its square brackets. The generator adds those brackets only when the translated title does not already contain the English words. Turkish titles often give the English name in round brackets ("CRediT (Katkı Rolleri Taksonomisi)", "Ödeme Duvarı (Paywall)"), and the German H-index page is titled "H-Index, Hirsch Index". So the English page won.

The template now also indexes every page by its en_title, which all glossary pages carry in their front matter. A translated page therefore wins over the English one for the same term.

Effect (hugo build of this branch compared with rebrand-doors)

  • Related-term links to the English page where a translation exists: 36 before (32 Turkish, 4 German), 0 after.
  • The related-terms lines on English, Arabic and Chinese pages are byte-identical. The number of unlinked related terms is unchanged in every language.
  • Links to English pages for terms a language really lacks (e.g. Turkish has no Trim-and-fill method) stay as they are.

Check: a new check 23 in scripts/check_seo_html.py fails when a translated glossary page links a related term to an English page whose hreflang links list a page in the same language. It fails on 36 links before this change, passes after, and has two unit tests. All 23 checks and check_sitemap_lastmod.py pass, as do the unit tests.

#1189 also edits the related-terms block of layouts/glossary/single.html, so whichever merges second may need a small rebase. The change here is one line in the $names loop.

Created with Claude Opus 5.5 in Claude Code.


Summary by cubic

Fixes related-term links on Turkish and German glossary pages so they point to the translated page when one exists rather than the English page. 36 links (32 Turkish, 4 German) now reach the translation; English, Arabic, and Chinese pages are byte-identical, and links to English pages for terms a language lacks stay as they are.

The related-terms lookup only matched the English name in square brackets, which translated titles carry only when they don't already contain the English words — Turkish titles use round brackets ("Ödeme Duvarı (Paywall)") and the German H-index page is titled "H-Index, Hirsch Index". The template now also indexes each page by the en_title in its front matter, so a translated page wins over the English one for the same term.

Adds check 23 to scripts/check_seo_html.py that fails when a translated glossary page links a related term to an English page whose hreflang links list a page in the same language, with three unit tests. The checker follows the redesigned related-terms section from #1189 and ignores a preview URL prefix. This branch touches the same related-terms block as #1189; whichever merges second needs a small rebase — the change here is one line in the $names loop.