Jekyll Robots Configuration
12 Feb 2017Sometimes we want to tell search engines to index our pages, but sometimes we don’t. Search Engine Optimization helps you make your pages appear at better location, while robots meta tag can prevent search engine to crawl certain pages. For my blog, I don’t want search engine to index the tag pages.
Ultimately, I want the following html meta tag appear in all the tag pages.
To achieve this result, we need to modify the front matter of tag pages, and add a few lines to the format of head section of pages.
Front Matter
For all tag pages, let’s add a new property robots
to its front matter:
---
layout: tagpage
title: "Tag: hololens"
tag: hololens
robots: noindex
---
Then, for all tag pages, it has an additional property accessed via page.robots
.
If you are curious about how to create tag pages, please visit this post.
Head Element
In the layout of the head section, usually at _includes/head.html
, the following lines should be added to correctly add robots
meta tag.
Then, jekyll serve!
Thanks for reading!