yari icon indicating copy to clipboard operation
yari copied to clipboard

More and more links are running into a 404

Open alexander-schranz opened this issue 3 years ago • 6 comments

Summary

More and more links to mdn docs are landing on page not found. Not sure what was restructered but it would be nice to track 404 and check where the content was moved.

URL

https://developer.mozilla.org/en-US/Core_JavaScript_1.5_Guide/Exception_Handling_Statements/try...catch_Statement

If I don't forget I will add here over the time more links, but I would recommend tracking the 404 and redirect them correctly.

Reproduction steps

Somewhere today I clicked a link like this: https://developer.mozilla.org/en-US/Core_JavaScript_1.5_Guide/Exception_Handling_Statements/try...catch_Statement and this content seems to be gone or not correctly redirected.

Expected behavior

Redirect to to most new page with for that content.

Actual behavior

ends in 404

Device

Desktop

Browser

Firefox

Browser version

Stable

Operating system

Mac OS

Screenshot

No response

Anything else?

Filled a bug report because of: https://twitter.com/MozDevNet/status/1541832746334650369

Validations

alexander-schranz avatar Jun 28 '22 23:06 alexander-schranz

If I remember correctly we moved Core_JavaScript_1.5_Guide pages to their current location in 2014 or 2015. I'm surprised there are still links to these old URLs out there. Out of curiosity, where did you find such links?

teoli2003 avatar Jun 29 '22 04:06 teoli2003

Not sure where but for example stackoverflow answers link to it: https://stackoverflow.com/questions/5963045/can-syntax-errors-be-caught-in-javascript. The internet never forget something 😄

alexander-schranz avatar Jun 30 '22 23:06 alexander-schranz

Yes, it is worth fixing (and not too difficult) @schalkneethling Do you think you can provide the list of 404 pages with Core_JavaScript_1.5_Guide in their slug over the last year, then we can add the modern pages and add redirects.

If we solve it this way, we can transfer this to mdn/content.

teoli2003 avatar Jul 01 '22 05:07 teoli2003

Yes, it is worth fixing (and not too difficult) @schalkneethling Do you think you can provide the list of 404 pages with Core_JavaScript_1.5_Guide in their slug over the last year, then we can add the modern pages and add redirects.

If we solve it this way, we can transfer this to mdn/content.

I believe the best person for that would be either @Guyzeroth or @fiji-flo

schalkneethling avatar Jul 01 '22 11:07 schalkneethling

I found my general issue the links on caniuse are directed based on my Accept-Language: de which ends on 404 pages:

  • https://developer.mozilla.org/docs/Web/CSS/aspect-ratio -> https://developer.mozilla.org/de/docs/Web/CSS/aspect-ratio

  • Found on: https://caniuse.com/mdn-css_properties_aspect-ratio

  • https://developer.mozilla.org/docs/Web/API/ImageBitmap/width -> https://developer.mozilla.org/de/docs/Web/API/ImageBitmap/width

  • Found on: https://caniuse.com/mdn-api_imagebitmap_width

  • https://developer.mozilla.org/docs/Web/CSS/flex-direction -> https://developer.mozilla.org/de/docs/Web/CSS/flex-direction

  • Found on: https://caniuse.com/mdn-css_properties_flex-direction

Personally prefer english docs so I would be fine with a none language specific redirect here :). But thats just me.

alexander-schranz avatar Jul 28 '22 22:07 alexander-schranz

@mdn/core-dev I have also run into this with /community if used without a locale. https://developer.mozilla.org/community is a 404 but https://developer.mozilla.org/en-US/community is fine

schalkneethling avatar Jul 29 '22 11:07 schalkneethling

First of all, we do track 404s and we add missing redirects for frequently visited urls from time to time.

In the case of the URL you're citing, it appears that https://github.com/mdn/content/pull/1857 removed the corresponding explicit redirects from _redirects.txt (in mdn/content), because they were added to our fundamental redirects (here in mdn/yari) in https://github.com/mdn/yari/pull/2698. And they still seem to be (except that they require the /docs/ part in the url):

https://github.com/mdn/yari/blob/3c9d149aef2a4d6c747ab1f4e55a321e36d48a89/libs/fundamental-redirects/index.js#L1215-L1225

And indeed, while /en-US/Core_JavaScript_1.5_Guide does NOT redirect (due to the missing /docs/ part), /en-US/docs/Core_JavaScript_1.5_Guide does redirect to /en-US/docs/Web/JavaScript/Guide/, except that this specific page (and the whole "Exception Handling Statements" area) was moved into a section of Web/JavaScript/Guide/Control_flow_and_error_handling.

@alexander-schranz If you like, you could try and open a PR in mdn/content to add the following redirects to the _redirects.txt, but I cannot guarantee that they would be accepted:

/en-US/docs/Web/JavaScript/Guide/Exception_Handling_Statements /en-US/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#exception_handling_statements
/en-US/docs/Web/JavaScript/Guide/Exception_Handling_Statements/throw_Statement /en-US/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#exception_handling_statements
/en-US/docs/Web/JavaScript/Guide/Exception_Handling_Statements/try...catch_Statement /en-US/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#exception_handling_statements

Not sure where but for example stackoverflow answers link to it: https://stackoverflow.com/questions/5963045/can-syntax-errors-be-caught-in-javascript.

This StackOverflow post links to /en-US/Core_JavaScript_1.5_Guide/Statements#try...catch_Statement, and the redirect would work if the URL had /docs/ in it. I believe StackOverflow users with enough reputation could actually update the links in the answer.

I found my general issue the links on caniuse are directed based on my Accept-Language: de which ends on 404 pages:

This is a separate issue, see e.g.:

  • https://github.com/mdn/yari/issues/275
  • https://github.com/mdn/yari/issues/2724

I have also run into this with /community if used without a locale. https://developer.mozilla.org/community is a 404 but https://developer.mozilla.org/en-US/community is fine

I think only /docs/* without a locale get redirected to /{locale}/docs/* though, but we could look into redirecting meta pages as well.

caugner avatar Aug 22 '22 19:08 caugner

I think the main problem is that not all pages are translated so example https://developer.mozilla.org/docs/Web/CSS/aspect-ratio redirect me to https://developer.mozilla.org/de/docs/Web/CSS/aspect-ratio.

So the strategy would need to be implemented there. If the page does not exist in the "target locale" it should not redirect to a 404 page.

There are 2 possibilites. Show default locale / english content on https://developer.mozilla.org/de/docs/Web/CSS/aspect-ratio or do a redirect to /en/... instead of /de/....

alexander-schranz avatar Aug 22 '22 19:08 alexander-schranz

I think the main problem is that not all pages are translated so example https://developer.mozilla.org/docs/Web/CSS/aspect-ratio redirect me to https://developer.mozilla.org/de/docs/Web/CSS/aspect-ratio.

In that case, you do already get a message "The page you requested doesn't exist in German but it exists in English": image

Note that the German locale will be archived in the next few weeks, so from that moment on there will be a redirect to en-US, like already in place for other retired locales: https://developer.mozilla.org/tr/docs/Web/CSS/aspect-ratio

caugner avatar Aug 23 '22 09:08 caugner