Jekyll `related_posts` function based on tags.


Jekyll related_posts function based on tags (works on Jekyll3). It replaces original Jekyll's related_posts function to use tags to calculate relationships.

The calculation algorithm is based on related_posts-jekyll_plugin by @LawrenceWoodman.


Add this line to your application's Gemfile:

gem 'jekyll-tagging-related_posts'

And then execute:

$ bundle

Or install it yourself as:

$ gem install jekyll-tagging-related_posts


Edit _config.yml to use the plug-in:

  - jekyll-tagging-related_posts

Then, add site.related_posts in your post layout page. For example:

{% if site.related_posts.size >= 1 %}
  <h3>Related Posts</h3>
  {% for related_post in site.related_posts limit: 5 %}
    <li><a href="{{ related_post.url }}">{{ related_post.title }}</a></li>
  {% endfor %}
{% endif %}


After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.


Bug reports and pull requests are welcome on GitHub at This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.


The gem is available as open source under the terms of the MIT License.

jekyll logo

Want a Jekyll website built?

Hire a Jekyll developer