Skip to content
Permalink
Browse files

Fix top posts index logic

  • Loading branch information...
bf4 committed Oct 3, 2017
1 parent b6274cb commit 891d407fe30855bd5b69080954ff200a2a08b828
Showing with 8 additions and 13 deletions.
  1. +8 −13 index.html
@@ -9,20 +9,15 @@
<section class="content">

<ul class="listing">
{% for post in site.posts limit:10 %}
<li>
<span>{{ post.date | date_to_string }}</span> <a href="{{ BASE_PATH }}{{ post.url }}">{{ post.title }}</a>
</li>
{% endfor %}
{% for category in site.categories %}
{% if category[0] == 'top' %}
{% assign posts = category[1] %}
{% for post in posts %}
<li>
<span>{{ post.date | date_to_string }}</span> <a href="{{ BASE_PATH }}{{ post.url }}">{{ post.title }}</a>
</li>
{% endfor %}
{% assign recent_posts_count = 0 %}
{% for post in site.posts %}
{% comment %}always returns first 10 posts, then only 'top' posts after that'{% endcomment %}
{% if recent_posts_count < 10 or post.categories != null and post.categories contains 'top' %}
<li>
<span>{{ post.date | date_to_string }}</span> <a href="{{ BASE_PATH }}{{ post.url }}">{{ post.title }}</a>
</li>
{% endif %}
{% assign recent_posts_count = recent_posts_count | plus: 1 %}
{% endfor %}
</ul>

0 comments on commit 891d407

Please sign in to comment.
You can’t perform that action at this time.