Skip to content

Commit

Permalink
Improve documentation for collection pages
Browse files Browse the repository at this point in the history
  • Loading branch information
frankieroberto authored and paulrobertlloyd committed Apr 17, 2024
1 parent a3c062e commit 8f578bc
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions docs/layouts/collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@ description: Layout for a paginated list of pages.

> View an <a href="/example-layouts/collection" target="_blank">example page that uses this layout (opens in a new tab)</a>
To use this layout, make `collection` the value for a page’s `layout` key:
To use this layout, make `collection` the value for a page’s `layout` key.

You will also need to say which pages should be listed, by using the options under the `pagination` key:

```yaml
---
layout: collection
title: Page title
paginationHeading: Posts
pagination:
data: collections.post
size: 20
reverse: true
---

Page content
Page introduction content (optional).
```

In addition to [common front matter options](/layouts#common-front-matter-options), this layout accepts the following options:
Expand All @@ -33,6 +40,21 @@ In addition to [common front matter options](/layouts#common-front-matter-option
{ text: "object" },
{ text: "**Required.** Pages to show in the paginated list. Learn more about [pagination](https://www.11ty.dev/docs/pagination/) in the documentation for Eleventy." | markdown }
],
[
{ text: "pagination.data" },
{ text: "string" },
{ text: "The pages that should be listed, usually a reference to a [collection](https://www.11ty.dev/docs/collections/)" | markdown }
],
[
{ text: "pagination.size" },
{ text: "number" },
{ text: "The number of items to list" }
],
[
{ text: "pagination.reverse" },
{ text: "boolean" },
{ text: "Set to `true` to list the items in reverse date order" | markdown }
],
[
{ text: "paginationHeading" },
{ text: "string" },
Expand Down

0 comments on commit 8f578bc

Please sign in to comment.