Skip to content

Front Page - Paginate - show FULL posts #2945

Answered by darthmall
synj00 asked this question in Q&A
Discussion options

You must be logged in to vote

index.html is included in collections.all. So when you try to iterate over that collection and put its contents in the page, you create an infinite loop.

You have two choices:

  1. Add eleventyExcludeFromCollections: true to the frontmatter of index.html
  2. Create a custom collection for your posts and iterate over that instead of collections.all

I favor the second option, personally. You could either add a post tag (or something) to all of the pages in your posts/ directory using a directory data file like this:

posts/posts.11tydata.json

{
  "tags": ["post"]
}

Or you can use the collections API in your eleventy config to create the custom collection.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by synj00
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants