Skip to content

Commit

Permalink
Add pagination info to sections (#2653)
Browse files Browse the repository at this point in the history
* Add pagination info to get_section

* Add documentation for pagination information

* Stick to section properties

`paginated` attributes removed
  • Loading branch information
ZzMzaw authored Oct 11, 2024
1 parent 9119e9f commit ad79860
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions components/content/src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ pub struct SerializingSection<'a> {
backlinks: Vec<BackLink<'a>>,
generate_feeds: bool,
transparent: bool,
paginate_by: &'a Option<usize>,
paginate_reversed: bool,
}

#[derive(Debug)]
Expand Down Expand Up @@ -226,6 +228,8 @@ impl<'a> SerializingSection<'a> {
subsections,
translations,
backlinks,
paginate_by: &section.meta.paginate_by,
paginate_reversed: section.meta.paginate_reversed,
}
}
}
8 changes: 8 additions & 0 deletions docs/content/documentation/templates/pages-sections.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,16 @@ backlinks: Array<{permalink: String, title: String?}>;
generate_feeds: bool;
// Whether this section is transparent. Taken from the front-matter if set
transparent: bool;
// How many items per pager (if defined)
paginate_by: Number?;
// If items order is reversed in the pagination (defaults to false)
paginate_reversed: bool;
```
Information about pagination is useful when using the `get_section` Tera function for which the `paginator` is not available.
See [pagination template documentation](@/documentation/templates/pagination.md) for more information on the `paginator` variable.
## Table of contents
Both page and section templates have a `toc` variable that corresponds to an array of `Header`.
Expand Down

0 comments on commit ad79860

Please sign in to comment.