Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Also filter hreflang alternate-language tags to translated articles
_includes/head.html has the same bug as _includes/nav.html: it builds
an hreflang link for every locale unconditionally, so an under-translated
article ships <link rel="alternate" hreflang="..."> tags pointing at pages
that 404. CI caught this via html-proofer's internal-link check on the new
zh-hans article (27 dead links, one per locale lacking the translation).

Apply the same site.articles | where: 'lang' / where: 'class' guard used
in nav.html and in the existing related-article lookup in article.html.
  • Loading branch information
czllll committed Aug 22, 2026
commit dd2bfbe9a73196b7a540d86b0f9b14bfd8915774
6 changes: 6 additions & 0 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
{% assign locales = site.data.locales | sort %}
{% for locale in locales %}
{% assign lang = locale[0] %}
{% if page.layout == 'article' and lang != page.lang %}
{% assign translated_article = site.articles | where: 'lang', lang | where: 'class', page.class | first %}
{% unless translated_article %}
{% continue %}
{% endunless %}
{% endif %}
{% assign page_lang_slash = page.lang | append: '/' | prepend: '/' %}
{% assign default_url = page.url | replace: page_lang_slash, '/' %}
{% if lang == "en" %}
Expand Down