Jekyll related_posts function based on tags.
Ruby HTML Shell
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

jekyll-tagging-related_posts

Build Status Gem Version Test Coverage Code Climate Dependency Status

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.

Requirements

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
  - 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.