How can I exclude a few specific posts from search engine indexing?


#1

Is there a way to exclude a few specific posts by being indexed by the search engines?
All the posts are visible and searchable within the site. I mainly have types of posts - work related, and not work related. I would like to exclude the latter from showing up in google search results by default.


#2

Hello,
I find a solution for your case :slight_smile:

Excluding pages from search :
By default, every page is included in the search. Depending on the type of content you’re including, you may find that some pages will break the JSON formatting. If that happens, then the search will no longer work.

If you want to exclude a page from search add search: exclude in the page’s frontmatter.

https://idratherbewriting.com/documentation-theme-jekyll/mydoc_search_configuration.html

Cordially


#3

You’ll want to add some logic to your layout(s) or includes to add something like this to <head></head>.

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

This will instruct search bots not to index the page or follow any links on it. You can also exclude pages in a robots.txt file.


#5

Thanks. But this talks about it the site search, I came across it before posting here. I was looking for search engine indexing exclusions.


#6

Thanks. I will try out the the first way. Manually adding links to `robots.txt’ would be a tedious thing in the long run.


#7

See also https://github.com/jekyll/jekyll-sitemap#exclusions to make sure you exclude those posts from your sitemap.