Adding meta description to Jekyll

Jekyll is a blog-aware static website generator written in Ruby that uses Liquid for templating and Markdown or Textile for writing posts and pages. Jekyll also supports CSS pre-processors like SASS, LESS. Here is an uncomplicated way to add meta description to your Jekyll-powered website.

Meta description helps search engine bots display a summary of a website’s post or page and helps the user get a concise explanation of what content he/she is about to view. The description does not need to be a paragraph of a specific post or page; it can be a small line to explain the content.

Jekyll uses Liquid for templating, making it easy to add more markup to your source code.

  • Adding description: string to your _config.yml example
description: This is an awesome website  
Code language: HTTP (http)

Add these lines to your head.html

{% if page.description %}
{{page.description}}
{% else %}
{{site.description}}
{% endif %}
Code language: PHP (php)

You can now add description: string to the front matter of your post or page and add a small summary.

Then build your website.

jekyll build  

Now you have a meta description for your Jekyll-based website.