Every website owner wants his or her website pages to rank well in search engine results (SERP). But some pages don’t’ need to be indexed and ranked in search results. These can be pages with confidential information, pricing information, thank you or checkout page, some company stats which need to be shared within the organization only, etc. You will learn how to NoIndex a page or a specific paragraph in a webpage.
How to NoIndex A Page?
Sometimes you need to hide some pages from being indexed in search engine results. In this case, you need to NoIndex those web pages. There are two ways to NoIndex webpages as highlighted here:
1. Add NoIndex Tag
This is the foremost used way to NoIndex a web page. In this way, you need to add noindex
tag as a directive in your web page’s source code. This noindex
tag needs to be added to the <head>
section of your webpage. This way Google and other search engines can see and obey this noindex
directive at the start of the webpage’s source code.
<meta name="robots" content="noindex">
In case you want to NoIndex a specific bot instead of all then your noindex tag should be like:
<meta name="bingbot" content="noindex">
One thing you must remember is if you add this noindex
tag to a webpage then you should not block that web page in the robots.txt file. Otherwise, your webpage with noindex directive can rank in search results as Google is not crawling this webpage.
2. HTTP Response Header with noindex
Another way to NoIndex a web page is to return an X-Robots-Tag
header with a value of noindex
.
HTTP/1.1 200 OK
(…)
X-Robots-Tag: noindex
(…)
But if you want to NoIndex a specific bot then this code will be like:
HTTP/1.1 200 OK
(…)
X-Robots-Tag: googlebot: noindex
(…)
How to NoIndex A Paragraph?
Actually, there is not any way to NoIndex a paragraph or a portion of text using noindex
tag on your webpage. But you can highlight a specific paragraph or text not to be shown in search results which is available on your web page using data-nosnippet
HTML attribute.
John Mueller’s View on How to NoIndex A Paragraph?
In a recent Google SEO office-hours video a user asked a query about not indexing a specific paragraph in a webpage. The question was like this ‘Is there any way to mark do not index this paragraph from my web page?’ as if I don’t want Google to show content from that specific paragraph in its search snippet.
John replied to this query with two possible options as highlighted below:
1. Use Data NoSnippet HTML Attribute
John Mueller replied to this query with first option as using data-nosnippet that should be used if you don't want to show some particular text
or paragraph in Google search snippet.
Not really so at least there’s no direct way that you can do that uh so you could use the data no snippet to say that this is something that you don’t want to have shown in a snippet that might be enough in a lot of cases.
John Mueller
<p><span data-nosnippet>This paragraph will not be shown in Google search result</span>.</p>
2. Use Javascript File
Further, John added another way to not index a specific paragraph or text by adding that particular text in a JavaScript file and block that JavaScript file in your robots.txt file. This way Google will not crawl text in that JavaScript file and it will not be shown in the search snippet.
If it’s really content that you must avoid to have index there like if there are licensing reasons or other legal reasons why it should never be indexed like that one of the things you could do is use JavaScript to pull that content in and use robots.txt to block that JavaScript file from being crawled.
John Mueller
But you should leverage JavaScript file only in critical situations like legal reasons why that must not be indexed.
How to NoIndex A PDF?
You might have PDFs on your website in addition to the web pages. Sometimes you might need to noindex some PDF as if you don’t want to show that PDF in search results. In this case, you will need to add an X-Robots-Tag: noindex in the HTTP header.
Summary
You might have some web pages, specific text in your webpage, or some PDFs that you don’t want to show in search results. To hide all these you should know how to noindex in real. If you want to urgently remove some content from your website then leverage URL Removals under the Index section in your Google Search Console.
Hope now you can easily leverage ways to noindex your website’s internal information, confidential data, and things that you don’t want to be shown in the search snippet.
Here you can see the Google SEO Office-hours video where John Mueller shares two ways to noindex a paragraph for your reference.