Skip to content

Commit

Permalink
Add jekyll-related-posts plugin
Browse files Browse the repository at this point in the history
Fixes #11
  • Loading branch information
nhoizey committed Dec 28, 2016
1 parent 97d9752 commit dce68b3
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ group :jekyll_plugins do
gem 'jekyll-cloudinary'
gem 'jekyll-archives'
gem 'jekyll-microtypo'
gem 'jekyll-related-posts'
end
23 changes: 23 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,28 @@ GEM
autoprefixer-rails (6.6.0)
execjs
awesome_print (1.7.0)
backports (3.6.8)
colorator (1.1.0)
concurrent-ruby (1.0.2)
execjs (2.7.0)
extras (0.1.0)
forwardable-extended (~> 2.5)
fast-stemmer (1.0.2)
fastimage (2.0.1)
addressable (~> 2)
ffi (1.9.14)
forwardable-extended (2.6.0)
httpclient (2.8.2.4)
i18n (0.7.0)
jekyll (3.3.1)
addressable (~> 2.4)
colorator (~> 1.0)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 1.1)
kramdown (~> 1.3)
liquid (~> 3.0)
mercenary (~> 0.3.3)
pathutil (~> 0.9)
rouge (~> 1.7)
safe_yaml (~> 1.0)
jekyll-archives (2.1.1)
Expand All @@ -58,13 +62,23 @@ GEM
fastimage (~> 2.0, >= 1.8)
jekyll (~> 3.1, >= 3.0)
pathutil (>= 0.8)
rack (> 1, < 2)
sprockets (~> 3.3, < 3.7)
jekyll-cloudinary (1.5.2)
jekyll (>= 3.0, < 4.0)
rmagick (>= 2.0, < 3.0)
jekyll-microtypo (0.0.6)
jekyll (>= 3.0, < 4.0)
jekyll-postfiles (2.0.0)
jekyll-related-posts (0.1.2)
fast-stemmer (~> 1.0)
jekyll (~> 3.0)
liquid (~> 3.0)
nmatrix (~> 0.2)
nmatrix-lapacke (~> 0.2)
pqueue (~> 2.1)
stopwords-filter (~> 0.3)
tokenizer (~> 0.3)
jekyll-sass-converter (1.5.0)
sass (~> 3.4)
jekyll-watch (1.5.0)
Expand All @@ -78,11 +92,18 @@ GEM
mercenary (0.3.6)
mini_portile2 (2.1.0)
minitest (5.10.1)
nmatrix (0.2.3)
packable (~> 1.3, >= 1.3.5)
nmatrix-lapacke (0.2.3)
nmatrix (= 0.2.3)
nokogiri (1.7.0)
mini_portile2 (~> 2.1.0)
nuggets (1.0.0)
packable (1.3.8)
backports
pathutil (0.14.0)
forwardable-extended (~> 2.6)
pqueue (2.1.0)
rack (1.6.5)
rake (12.0.0)
rb-fsevent (0.9.8)
Expand All @@ -97,8 +118,10 @@ GEM
sprockets (3.6.3)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
stopwords-filter (0.3.1)
thor (0.19.4)
thread_safe (0.3.5)
tokenizer (0.3.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (3.0.4)
Expand Down
5 changes: 5 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,8 @@ jekyll-archives:
permalinks:
year: /:year/
month: /:year/:month/

related:
max_count: 6
min_score: 0.1
accuracy: 0.75
3 changes: 3 additions & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ <h1 id="post" itemscope itemtype="https://schema.org/breadcrumb" itemprop="child

<aside>
<h2>À découvrir aussi</h2>
<related-posts />
{% comment %}
<div class="list related">
{% assign nb = 0 %}
{% for post in site.related_posts limit:7 %}
Expand All @@ -82,4 +84,5 @@ <h3><a href="{{ post.url }}">{{ post.title }}</a></h3>
{% endif %}
{% endfor %}
</div>
{% endcomment %}
</aside>
11 changes: 11 additions & 0 deletions _layouts/related.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% if related_posts != empty %}
<h2>À découvrir aussi</h2>
<div class="list related">
{% for post in related_posts %}
<article {% if post.lang %}lang="{{ post.lang }}"{% endif %} data-score="{{ post.score }}">
<h3><a href="{{ post.url }}">{{ post.title }}</a></h3>
{% include article-header.html page=post %}
</article>
{% endfor %}
</div>
{% endif %}

0 comments on commit dce68b3

Please sign in to comment.