Skip to content

Commit dd2634f

Browse files
authored
Merge pull request BlackPythonDevs#217 from oleksis/blog-posts-limit-build-all
Limit the number of posts displayed on your site but still build all posts
2 parents f87353f + 543d62d commit dd2634f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

_includes/posts.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ <h2 class="post-list-heading">{{ page.list_title }}</h2>
1010
{%- endif -%}
1111
<ul class="post-list">
1212
{%- assign date_format = site.bpdevs.date_format | default: "%b %-d, %Y" -%}
13+
{% assign count = 0 %}
14+
{% assign limit_posts = 3 %}
1315
{%- for post in posts -%}
16+
{%- if count < limit_posts -%}
1417
<li>
1518
<span class="post-meta">{{ post.date | date: date_format }}</span>
1619
<h3>
@@ -22,6 +25,8 @@ <h3>
2225
{{ post.excerpt }}
2326
{%- endif -%}
2427
</li>
28+
{%- assign count = count | plus:1 -%}
29+
{%- endif -%}
2530
{%- endfor -%}
2631
</ul>
2732

0 commit comments

Comments
 (0)