diff --git a/content/now.njk b/content/now.njk index 8b577e3..232b6bf 100644 --- a/content/now.njk +++ b/content/now.njk @@ -3,13 +3,7 @@ layout: layouts/base.njk eleventyNavigation: key: Now order: 4 -numberOfLatestPostsToShow: 4 --- -{% set postsCount = collections.now | length %} -{% set latestPostsCount = postsCount | min(numberOfLatestPostsToShow) %} -{% set postslist = collections.now | head(-1 * numberOfLatestPostsToShow) %} -{% set postslistCounter = postsCount %} -{% set morePosts = postsCount - numberOfLatestPostsToShow %}

Now: What’s Been Going on Lately?

{% set now = collections.now | last %} @@ -18,35 +12,11 @@ numberOfLatestPostsToShow: 4

Updated: {{ now.date | readableDate }} | What is a now page?

+{% set postsCount = collections.now | removeMostRecent | length %} {% if postsCount > 1 %}

Previous Entries:

-
-
- {% for post in postslist | reverse %} - {% if post.data.title != now.data.title %} - - {% endif %} - {% endfor %} -
-{% if morePosts > 0 %} -

See {{ morePosts }} more post{% if morePosts != 1 %}s{% endif %}.

+{% set postslist = collections.now | removeMostRecent %} +{% set showPostListHeader = false %} +{% include "postslist.njk" %} {% endif %} -
- -{% endif %} diff --git a/eleventy.config.js b/eleventy.config.js index c3388d7..89697b3 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -54,6 +54,10 @@ module.exports = eleventyConfig => { return DateTime.fromJSDate(dateObj, { zone: 'utc' }).toFormat('yyyy-LL-dd'); }); + eleventyConfig.addFilter("removeMostRecent", arr => { + return arr.slice(0, arr.length-1); + }); + // Shortcodes eleventyConfig.addNunjucksFilter("cowsay", cowText => { const cowCaptionReplacementTable = [