Add meta description in Jekyll posts

The meta descriptions in web pages help us to get more visitors through Search Engine Result Pages. They can provide a brief introduction about our content as a search description. But we need unique meta descriptions for our web pages.

In Jekyll, we can use YAML front matter block of posts for this purpose. In our YAML front matter, set up a variable and assign value for that variable. We can access the value of this variable through our site using Liquid tags.

Then we will convert the value of this variable as a content of meta Description tag for our web pages. So remember that the value, the meta description must be a unique tiny description about our content.

If possible, try to use our keywords in meta description & limit meta description length in 160 characters.

Step 1: Add meta description in post / page YAML front matter like below example.

---
layout: post
title: Add meta description in Jekyll posts & get more visitors
description: We can easily add meta description in Jekyll post. It can generate more visitors for our blog through SERP(Search Engine Result Pages) & indirectly improve SEO.
---

Step 2: Access this variable from YAML front matter & use it for HTML meta description tag in HTML head section of template file.

{% if page.description %}<meta name="description" content="{{ page.description }}">{% endif %}

This line of code say that, if there is any description in YAML front matter, use it as a content for HTML meta description tag. If there is no any description at there, Jekyll never generate meta description tag for our web pages.

Recent Posts

  1. Replace string in multiple files - Command line
  2. Solve Grunt error - Port 35729 is already in use by another process
  3. Install WP-CLI
  4. Install LAMP - Apache2 , MariaDB, PHP 7 on Debian 8
  5. Enable / Disable Magento 2 module using command line


Questions / Comments

If you found this article interesting, found errors, or just want to discuss about them, please get in touch. Send an email to hello@sarathlal.com & I like your words.