Skip to content

Commit

Permalink
fix related posts ordering due to Jekyll bug
Browse files Browse the repository at this point in the history
Will be fixed in Jekyll v1.0.4; until then do this workaround.

jekyll/jekyll#1240
  • Loading branch information
mislav committed Jul 14, 2013
1 parent 1a6cb30 commit ca1d6d4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ <h1 class=entry-title>{{ page.title }}</h1>
<h2>Also on this site</h2>

<ol class="posts">
{% for post in site.related_posts limit:3 %}
{% for related in site.posts %}
{% if related.url != page.url and related.link == null and (void == null or void != '2') %}
<li>
<span class="date">{{ post.date | date_to_string }}</span>
<a href="{{ post.url }}">{{ post.title }}</a>
<span class="date">{{ related.date | date_to_string }}</span>
<a href="{{ related.url }}">{{ related.title }}</a>
</li>
{% capture void %}{% increment related_shown %}{% endcapture %}
{% endif %}
{% endfor %}
</ol>
{% endunless %}
Expand Down

0 comments on commit ca1d6d4

Please sign in to comment.