skip to Main Content

probably duplicate question Best way to set up 404 pages in a angular SPA? but I didn’t find a reliable answer for my question .
I’m curious to know if there is a way to tell googlebot about a 404 page ?
there is a tag for this purpose called prerender-status-code but I’m didn’t find any official article from Google Seo Team to confirm that they respect this meta tag .
is this enough to follow the best practice specify in here ?
or should I do something more ? (perhaps something to do with Google Webmaster tools ?)
I do a research on a few well known SPAs and I noticed SoundCloud add a nofollow tag on their 404 pages , like this :

<meta content="noindex, nofollow" name="robots">

does googlebot respect a meta tag which has been added later by js ?

2

Answers


  1. The only way to tell google bot that this is 404 page is to send http status code 404.

    Regarding of prerender-status-code. It seems that you’ve read it on prernder.io. The real idea behind this meta tag is to tell prerender what is the page code it need throw to client. So you can control whether to send 404 (or any other code) depending of logic of your js application. You can read a bit more here https://github.com/prerender/prerender/issues/347

    I hope that after this Advanced google bot will be implemented we all will be able to have a deep breath! https://webmasters.googleblog.com/2017/12/rendering-ajax-crawling-pages.html

    Login or Signup to reply.
  2. You can dynamically add a meta tag in your 404 component:

    import { Component } from '@angular/core';
    import { Meta } from '@angular/platform-browser';
    
    @Component({
      selector: 'app-notfound',
      templateUrl: './notfound.component.html',
      styleUrls: []
    })
    export class NotFoundComponent {
    
      constructor(private meta: Meta) {
        meta.addTag({ name: "robots", content: "noindex" });
      }
    

    Google do it themselves on the angular.io site: https://github.com/angular/angular/blob/7b56daffe68c1874ece7ac3b5e252e1edfed980a/aio/src/index.html

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search