Skip to content

Commit

Permalink
update feed to limit items
Browse files Browse the repository at this point in the history
  • Loading branch information
hjonin committed Sep 15, 2023
1 parent 129f7a0 commit fd847e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion content/feed/feed.njk
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
# Metadata comes from _data/metadata.json
permalink: /feed/feed.xml
numberOfLatestPostsToShow: 10
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="{{ metadata.language }}">
Expand All @@ -14,7 +15,7 @@ permalink: /feed/feed.xml
<name>{{ metadata.author.name }}</name>
<email>{{ metadata.author.email }}</email>
</author>
{% for post in collections.posts | reverse %}
{% for post in collections.posts| head(-1 * numberOfLatestPostsToShow) | reverse %}
{% set absolutePostUrl %}{{ post.url | htmlBaseUrl(metadata.url) }}{% endset %}
<entry>
<title>{{ post.data.title }}</title>
Expand Down
3 changes: 2 additions & 1 deletion content/feed/json.njk
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
# Metadata comes from _data/metadata.json
permalink: /feed/feed.json
numberOfLatestPostsToShow: 10
---
{
"version": "https://jsonfeed.org/version/1.1",
Expand All @@ -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 }}",
Expand Down

0 comments on commit fd847e3

Please sign in to comment.