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

Broken link checkers should fallback nicely to English if need be #3104

Closed
peterbe opened this issue Mar 2, 2021 · 0 comments · Fixed by #3254
Closed

Broken link checkers should fallback nicely to English if need be #3104

peterbe opened this issue Mar 2, 2021 · 0 comments · Fixed by #3254
Assignees

Comments

@peterbe
Copy link
Contributor

peterbe commented Mar 2, 2021

See #3053 which this issue can be blocked by.
If there's a pure HTML link like:

<a href="/zh-CN/docs/Web/CSS/new-property"><code>new-property</code></a>

but that doesn't exist in zh-CN yet, we have a chance to fall back to en-US.
The Broken link checker always runs. If set, it also spits out a flaw. But every href value is checked.
And in the builder, we do have access to the translationsOf Map object so it's cheap to look up something. Like:

if (!exists('/zh-cn/docs/web/css/new-property')) {
  // But there's hope in English!
  if (exists('/en-us/docs/web/css/new-property')) {
    // Rewrite the <a href> and possibly add a tooltip or a extra class name
    ...
  }
}
@peterbe peterbe self-assigned this Mar 16, 2021
peterbe added a commit to peterbe/yari that referenced this issue Mar 16, 2021
fiji-flo pushed a commit that referenced this issue Mar 16, 2021
* Broken link checkers should fallback nicely to English if need be

Fixes #3104

* remove debugging

* adding tests
peterbe added a commit to peterbe/yari that referenced this issue Jun 1, 2021
* Broken link checkers should fallback nicely to English if need be

Fixes mdn#3104

* remove debugging

* adding tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant