Skip to content

Commit 29fb2fe

Browse files
committed
feat(index): add configurable limit on number of blogposts
1 parent 2f7f22e commit 29fb2fe

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ generate_rss = true
88

99
[extra]
1010
date_format = "%F"
11+
12+
[extra.home]
13+
max_posts = 3
1114
show_summaries = false
1215

1316
[extra.social_links]

templates/includes/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h2 class="post-list-heading">{{ section.title | default(value="Latest News") }}
2929
{% set posts = get_section(path="posts/_index.md") %}
3030
{% if posts and posts.pages | length > 0 %}
3131
<ul class="post-list">
32-
{% for post in posts.pages %}
32+
{% for post in posts.pages | slice(end=config.extra.home.max_posts) %}
3333
<li>
3434
{% if post.date %}
3535
{% set date_format = config.extra.date_format | default(value="%b %-d, %Y") %}

0 commit comments

Comments
 (0)