From fd847e3e69d18f514a0e207d10587c7bfd8be32c Mon Sep 17 00:00:00 2001 From: hjonin Date: Fri, 15 Sep 2023 17:12:48 +0200 Subject: [PATCH] update feed to limit items --- content/feed/feed.njk | 3 ++- content/feed/json.njk | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/content/feed/feed.njk b/content/feed/feed.njk index 61f63d3c..3019206a 100755 --- a/content/feed/feed.njk +++ b/content/feed/feed.njk @@ -1,6 +1,7 @@ --- # Metadata comes from _data/metadata.json permalink: /feed/feed.xml +numberOfLatestPostsToShow: 10 --- @@ -14,7 +15,7 @@ permalink: /feed/feed.xml {{ metadata.author.name }} {{ metadata.author.email }} - {% for post in collections.posts | reverse %} + {% for post in collections.posts| head(-1 * numberOfLatestPostsToShow) | reverse %} {% set absolutePostUrl %}{{ post.url | htmlBaseUrl(metadata.url) }}{% endset %} {{ post.data.title }} diff --git a/content/feed/json.njk b/content/feed/json.njk index b9ea38fe..ac35c7f7 100644 --- a/content/feed/json.njk +++ b/content/feed/json.njk @@ -1,6 +1,7 @@ --- # Metadata comes from _data/metadata.json permalink: /feed/feed.json +numberOfLatestPostsToShow: 10 --- { "version": "https://jsonfeed.org/version/1.1", @@ -14,7 +15,7 @@ permalink: /feed/feed.json "url": "{{ metadata.author.url }}" }, "items": [ - {% for post in collections.posts | reverse %} + {% for post in collections.posts| head(-1 * numberOfLatestPostsToShow) | reverse %} {% set absolutePostUrl = post.url | htmlBaseUrl(metadata.url) %} { "id": "{{ absolutePostUrl }}",