How to notify GoogleBot about 404 pages in Angular SPA? How to notify GoogleBot about 404 pages in Angular SPA? angularjs angularjs

How to notify GoogleBot about 404 pages in Angular SPA?


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


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