Jekyll seo

Implementing SEO Meta Tags in Jekyll Liquid (noindex, canonical, keywords)

In the Ruby programming language blog framework Jekyll, I implemented noindex, canonical, keywords, etc. as search engine optimization and SEO measures with Jekyll liquid, so I'll introduce the method. Initially, I was going to implement it with a plugin called jekyll-seo-tag... HTML SEO meta tags...

Shou Arisaka
2 min read
Oct 29, 2025

In the Ruby programming language blog framework Jekyll, I implemented noindex, canonical, keywords, etc. as search engine optimization and SEO measures with Jekyll liquid, so I’ll introduce the method.

Initially, I was going to implement it with a plugin called jekyll-seo-tag, but I wrote it myself because it has more extensibility and freedom. jekyll-seo-tag doesn’t seem to have something like hooks in WordPress, so for example, you can specify title=false for the title, but when I looked into it, things like canonical don’t seem to have that. In other words, you can’t prioritize canonical if it’s specified, and use the default if it’s not specified.

Since SEO meta tags in HTML basically prioritize the first one defined, having multiple definitions is not good. So I implemented it.

I made it work like this.

---
layout: post
title:  "test"
date:   2018-01-01 11:00:09 +0900
categories: blog
index: false
follow: true
keywords: hoge,fuga
canonical_url: 'https://example.com/'
---

Features

  • Specifying index: false makes it noindex
  • Specifying follow: false makes it nofollow
  • Specifying keywords allows you to set meta keywords with priority over the default
  • Specifying canonical_url allows you to set it with priority over the default
Source code ```liquid {% if page.title %}{% capture new_title %}{{ page.title }} << YAYB {% endcapture %}{{ new_title }}{% else %}{{ site.title }}{% endif %}

{% if page.keywords %} {% else %} {% endif %}

{% if page.canonical_url %} {% else %} {% endif %}

By the way, I've also tweaked <code>description</code> a bit. I'm making the title stick to the beginning.

Share this article

Shou Arisaka Oct 29, 2025

🔗 Copy Links