Prevent Search Engine Indexing of Angular 5 Website - Firebase

江枫思渺然 提交于 2020-05-25 17:19:09

问题


How do I prevent my Angular 5 site from being indexed by search engines? I don't understand the documentation on Firebase indexing, and it seems like it refers specifically to indexing a mobile app, not an Angular website.

Would I add a robots.txt, or does Firebase use another method?


回答1:


A few things you can do:

Solution 1

If you have access to the domain name and/or administrative privileges to the websites' HTML, you can go to Google/Bing webmaster tools and block your site from being indexed from within their dashboard.

Solution 2

You can add a robots.txt file and disallow all. Here is an example:

User-agent: *
Disallow: /

...or disallow specific paths:

User-agent: *
Disallow: /foo/
Disallow: /bar/

Source

Solution 3

The simplest solution, add this to your <head>:

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

Source


Note that whichever solution you go with, you probably need to go to Google/Bing webmaster tools to delete any links that have already been indexed, because they will still be there.

Remove Google URL's

Remove Bing URL's




回答2:


All references to robots.txt in the Firebase docs imply that you have to write it manually, and Google clearly states that a page without robots.txt will be indexed (or the robots meta tag or the X-Robots-Tag HTTP header). So yes, you'll have to write robots.txt manually.

As for your request from official sources, usually companies do not document automations they do not offer, so it'll be hard to see a list of all the automation that Firebase does not do for you.

Also, Angular does not create the robots.txt for you, but a quick look over the internet will show several tutorials explaining how to do so. Again, it is not documented that Angular does not do that, but if there was any automation... why would people post tutorials on how to do it manually? (Also, this rejected feature request.)



来源:https://stackoverflow.com/questions/48828630/prevent-search-engine-indexing-of-angular-5-website-firebase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!