jekyll-tdidf-related-posts
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
- Install the gem
jekyll-tdidf-related-posts
.$ gem install jekyll-tdidf-related-posts
- Add
jekyll-tdidf-related-posts
plugin in_config.xml
.yaml plugins: - jekyll-tdidf-related-posts
- Run
jekyll build
orjekyll 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
.
java
{% 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