Low commit activity in last 3 years
A long-lived project that still receives updates
Jekyll `related_posts` function based on tags (works on Jekyll3). It replaces original Jekyll's `related_posts` function to use tags to calculate relationships.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 3.9, < 5.0
 Project Readme

jekyll-tagging-related_posts

Test Gem Version Test Coverage Code Climate

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.

Installation

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

Usage

Edit _config.yml to use the plug-in:

gems:
  - jekyll-tagging-related_posts

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

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

Development

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.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/toshimaru/jekyll-tagging-related_posts/issues. 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.

License

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