Technical SEO for JavaScript developers [eng] / Martin Splitt

fwdays · 8K views · 2019 · 40:33

Open on YouTube

Web developmenttalkdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering how to signal 404 errors in single-page apps, since it shows that Googlebot understands JavaScript redirects to a real 404 page and explains noindex side effects.

Recommended by 1 people across 1 different months, 2018 to 2021.

What it is

A conference talk by Google's Martin Splitt at JavaScript fwdays'19 in Kyiv on technical SEO for JavaScript developers. It covers how Googlebot crawls and renders JavaScript sites, including how it treats JavaScript redirects and soft 404 pages.

What people said

Recommends Rose · 2020-05 · Stack Overflow · on “In a single-page app, what is the right way to deal with wrong URLs (404 errors)?”

For anybody who stumbles upon this, here is an interesting talk about how to handle soft-404's : [this video] (31:40 min mark). It's a pres made for the JavaScript fwdays conference and there is an interesting explanation as to why the noindex meta tag might cause unwanted side effects.

Cites Denis Pshenov · 2018-11 · Stack Overflow · on “In a single-page app, what is the right way to deal with wrong URLs (404 errors)?”

If you care about SEO, one of the ways that angular.io was able to solve this problem [LINK] (at least with Google anyway) is by using noindex meta tag [LINK] "to indicate soft-404 status which will prevent crawlers from crawling the content of the page". Apparently it can be added to the document via JavaScript. Alternatively, using JavaScript, you can redirect to a page that will respond with an actual HTTP 404 status code. Google understands JavaScript redirects [this video] just fine. Your original /does-not-exist page, when redirected to /404-error?from=does-not-exist , will be associated with the 404 status code returned by the server. The URL structure does not matter, only the status code

Cites user1383029 · 2021-03 · Stack Overflow · on “How to output http status code 404 in an Angular SPA (not Angular Universal)”

I found a video, where a guy from Google says, that at least the Google bot handles javascript redirects to 404 correctly: [this video] So I added this routing: const routes: Routes = [ ... { path: 'not-found-404', component: NotFoundComponent }, { path: '**', component: NotFoundComponent }, ]; So all not handled routes are redirected to the NotFoundComponent . You can find in-depth infos here [LINK] Then I changed my apache server config, to set the status code to 404, if /not-found-404 is loaded # my .htaccess file (before angular rewrites) RewriteRule ^not-found-404(\?.*)?$ - [R=404] # Redirect status ErrorDocument 404 /index.html Now the server returns a status code 404. And just loads my Ang