Hiding your site from search engines
To prevent your page from appearing within Google and other search engines, you must update the <head>
property of the page so that it includes the following meta tag:
<meta name="robots" content="noindex">
By including a noindex
meta tag, crawlers that crawl that page and see the tag will drop the page from their search results. This happens regardless of whether the site is being linked to any other site on the internet.
Much like our SEO
component, we could make this addition to a component so that we can reuse it across the pages when needed:
- Create a new file in
src/components/layout
calledNoRobots.js
. - Open the newly created file and add the following code to it:
import React from "react"; import { Helmet } from "react-helmet-async"; export default function NoRobots() { return ( <Helmet meta={[ { name: `robots`, content: "...