Skip to content

Commit

Permalink
Merge pull request #217 from oleksis/blog-posts-limit-build-all
Browse files Browse the repository at this point in the history
Limit the number of posts displayed on your site but still build all posts
  • Loading branch information
oleksis authored Jan 26, 2024
2 parents f87353f + 543d62d commit dd2634f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions _includes/posts.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ <h2 class="post-list-heading">{{ page.list_title }}</h2>
{%- endif -%}
<ul class="post-list">
{%- assign date_format = site.bpdevs.date_format | default: "%b %-d, %Y" -%}
{% assign count = 0 %}
{% assign limit_posts = 3 %}
{%- for post in posts -%}
{%- if count < limit_posts -%}
<li>
<span class="post-meta">{{ post.date | date: date_format }}</span>
<h3>
Expand All @@ -22,6 +25,8 @@ <h3>
{{ post.excerpt }}
{%- endif -%}
</li>
{%- assign count = count | plus:1 -%}
{%- endif -%}
{%- endfor -%}
</ul>

Expand Down

0 comments on commit dd2634f

Please sign in to comment.