Encodera

Thanks for reading!

Donate to the site — we work hard for you.

How to hide a page from search engines

Short answer

Add the robots meta tag with the noindex value to <head>:

<head>
  <meta name="robots" content="noindex">
</head>
<p>Search engines will not show this page in results.</p>

This hides pages that have no business in search: site search results, the cart, drafts, the "Thank you for your order" page.

The nofollow value asks not to count the links on the page. For a single link the rel attribute does the same:

<a href="https://example.com" rel="nofollow">A link search engines should not follow</a>

Links in user comments and paid links are marked this way — for ads there is also rel="sponsored".

robots.txt

The robots.txt file in the site root forbids robots to visit pages, while noindex forbids showing them in results. These are different things: a page closed in robots.txt can still appear in search via links from other sites, just without a description.

Common mistake

The page is closed both in robots.txt and with a noindex tag. The robot does not visit the page, so it never sees noindex — and the page may stay in search. To remove it from results, keep the page open to the robot and add noindex. And most importantly: this is not protection — secret pages are closed with a password.

Functions used in this recipe

  • <meta> — Page metadata: encoding, phone settings, a description for search engines.
  • <head> — The service part of the page: encoding, tab title, linked styles and scripts.
  • <a> — A link to another page, a file or a place on the page.

Thanks for reading!

Donate to the site — we work hard for you.