Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation for collection pages #268

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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