/jekyll-tfidf-related-posts

Jekyll plugin to show related posts based on the content, tags, and categories.

Primary LanguageRubyMIT LicenseMIT

jekyll-tfidf-related-posts

Gem Version DUB

Jekyll plugin to show related posts based on the content, tags, and categories. The similarity is calculated using TF-IDF(term frequency-inverted document frequency). Since tags and categories are use-defined values, those are considered with higher weights than a content while calculating.

How to install

  1. Install the gem jekyll-tfidf-related-posts.
$ gem install jekyll-tfidf-related-posts
  1. Add jekyll-tfidf-related-posts plugin in _config.xml.
plugins:
  - jekyll-tfidf-related-posts
  1. Run jekyll build or jekyll serve

How to use

This plugin calculates related posts and replaces site.related_posts containing recent 10 posts by default. So, you can render related posts by iterating site.related_posts.

{% for post in site.related_posts %}
  {% include related-post.html %}
{% endfor %}

GitHub Pages supports only these plugins. For GitHub Pages, you need to generate your site locally and then push static files to GitHub Pages site.

Configuration

By default, there are 4 related posts. You can configure it in the _config.yml

related_posts_count: 8