Skip to content

Commit

Permalink
Fix feed by not using pagination
Browse files Browse the repository at this point in the history
I think this should resolve #330 but need to test it somehow.
  • Loading branch information
frankieroberto committed Sep 24, 2024
1 parent 66d1f47 commit e4ceee2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions docs/feed.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@ To create a feed, add a file named `feed.njk` with the following content:
eleventyExcludeFromCollections: true
layout: feed
permalink: /feed.xml
pagination:
data: collections.post
size: 20
reverse: true
collection: post
size: 20
---
```

The `permalink` value is the location of the generated feed.

## Create a collection of pages

The feed will include all pages in the collection referenced by the `data` key of the `pagination` object.
The feed will include pages in the collection referenced in the `collection` key, up to a maximum specified in `size`, with the newest first.

You can create a collection by adding some code to your `eleventy.config.js`:

Expand Down
4 changes: 2 additions & 2 deletions layouts/feed.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<title>{{ options.homeKey }}</title>
<link href="{{ permalink | canonicalUrl }}" rel="self"/>
<link href="{{ options.url }}"/>
<updated>{{ collections.post | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
<updated>{{ collections[collection] | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
<id>{{ options.url }}/</id>
{%- for item in pagination.items %}
{%- for item in (collections[collection] | sort(true, false, "date") | slice(size)) %}
{%- set absolutePostUrl = item.url | canonicalUrl %}
<entry>
<title>{{ item.data.title }}</title>
Expand Down

0 comments on commit e4ceee2

Please sign in to comment.