Sarathlal N

Noindex Jekyll posts using meta robot tags

The search engines are great stuffs, they will pick our content and promote them. When we publish new web pages, Search engine automatically pick them with in days and provide search result based on the content.

But in some situations, every one want to hide some of their content in search result. We can use different methods like meta robot tags and robot.txt file for this purpose.

Usage of page wise meta robot tags is consider as the best option than robot.txt file for HTML web pages. So through this post, we try to add some meta robot tags in our Jekyll blog posts & pages to noindex them.

In regular cases, if there is no any meta robot tags in our web pages, search engines automatically index our content like content with <META NAME="ROBOTS" CONTENT="INDEX,FOLLOW"/> meta robot tag.

To hide some of my content from search results, I like to add meta robot tag, <META NAME="ROBOTS" CONTENT="NOINDEX,FOLLOW"/> only on these web pages and leave other web pages without any meta robot tags.

That means, normally all my web pages are indexed & followed by spiders and my hidden web pages are non indexed but followed by them.

So first we can make some marking on our posts & pages to be noindexed. We can use YAML front matters for this purpose.

Then the head of this post / page need <META NAME="ROBOTS" CONTENT="NOINDEX,FOLLOW"/> meta robot tag.

So add this if statement in your template head section & save file.

{% if page.noindex %}
{% endif %}

Can you make a sample post with our new YAML front matter? Then generate your Jekyll site one more time and check the source of some posts to verify our code. You can only find our meta robot tag only on our sample post.

Recent Posts

  1. Action hooks that trigger on, before or after add, update or delete actions of option - WordPress
  2. Get all variations of a variable product - WooCommerce
  3. Generate random string - Python
  4. Split domain from an email address - Python
  5. Get upcoming N days - PHP

Your Questions / Comments

If you found this article interesting, found errors, or just want to discuss about it, please get in touch.