question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Salvage 404s that are 404s because of lack of /docs/

See original GitHub issue

Take https://developer.mozilla.org/en-US/DOM/element.addEventListener for example. It came up in https://github.com/mdn/content/issues/2073

What ought to happen is that the fundamental redirects should have…

/en-US/DOM/(*) --> /en-US/docs/DOM/$1

but that list is very long. As of today, it’s basically anything where the word after the locale isn’t search or settings or sign-up or whatever we come up with next.

A simple fix would at least be to make the 404 page a bit more useful. A piece of async XHR could do something like:

// pseudo-code

if (VALID_LOCALES.has(currentLocale) && location.pathname.split('/')[1] !== 'docs') {
  const tryURL = location.pathname.split('/').splice(1, 0, 'docs').join('/') + '/index.json'
  const r = await fetch(tryURL)
  if (r.ok) {
    showGoodNews(r.url)
  }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
peterbecommented, Apr 19, 2021

I looked again, in Google Analytics. We have virtually no 404s that could easily be fixed with a redirect (that injects /docs/ after the locale).

1reaction
peterbecommented, Feb 25, 2021

@escattone Can you tie your PR to this issue that adds it to the fundamental redirects?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Do 404 errors hurt my site? | Google Search Central Blog
A: A soft 404 is when a web server returns a response code other than 404 (or 410 ) for a URL that...
Read more >
404 vs. Soft 404 Errors: What's The Difference & How To Fix ...
404 and soft 404s are different kinds of problems that require different approaches to diagnosing and fixing them.
Read more >
How to Find and Fix 404 Errors - Neil Patel
In this post, I'll cover everything you need to know about 404s, why they are bad for business, how to find them, and...
Read more >
How To Find & Fix 404 Errors On Your Website | Matthew Edgar
You need to check 404 errors on your website regularly because not-found errors create a bad user experience that causes people to leave ......
Read more >
What Are Google Soft 404 Errors (and How to Fix Them)
They're also a strange error because soft 404s are a hybrid of 404 and normal pages, and what exactly is causing this error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found