diff --git a/content/index.njk b/content/index.njk index 103f210..c23cd54 100644 --- a/content/index.njk +++ b/content/index.njk @@ -3,17 +3,19 @@ layout: layouts/home.njk eleventyNavigation: key: Home order: 1 +numberOfLatestPostsToShow: 3 --- {% set postsCount = collections.posts | length %} -{% set latestPostsCount = postsCount | min(3) %} +{% set latestPostsCount = postsCount | min(numberOfLatestPostsToShow) %}

Latest {{ latestPostsCount }} Post{% if latestPostsCount != 1 %}s{% endif %}

-{% set postslist = collections.posts | head(-3) %} +{% set postslist = collections.posts | head(-1 * numberOfLatestPostsToShow) %} {% set postslistCounter = postsCount %} {% include "postslist.njk" %} -{% if postsCount > 3 %} -

More posts can be found in the archive.

+{% set morePosts = postsCount - numberOfLatestPostsToShow %} +{% if morePosts > 0 %} +

{{ morePosts }} more post{% if morePosts != 1 %}s{% endif %} can be found in the archive.

{% endif %} {# List every content page in the project #}