yari icon indicating copy to clipboard operation
yari copied to clipboard

fix(build): prevent adding `only-in-en-us` css class to external links

Open yin1999 opened this issue 8 months ago • 0 comments

Summary

Fixes: mdn/yari#11434

Problem

The resolved redirection link may also be an external one. But we haven't check this before assigning the enUSFallbackURL, which caused the only-in-en-us CSS class to be added accidentally to the external links.

Solution

Check whether the resolved URL is an external one, if so, do not assign the enUSFallbackURL. Which means, the only-in-en-us CSS class would not be added.


Screenshots

Checkout the git commit sha f277be087b9484b077fc734e5192d83bc3ee04a1, which is the last commit sha before the fix in translated-content (mdn/translated-content#21711).

Check the section /zh-CN/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension#打包和发布:

Before

See: mdn/yari#11434

After

image


How did you test this change?

Run yarn dev, and check the rendered page.

yin1999 avatar Jun 18 '24 03:06 yin1999