Skip to content

Commit dcae79c

Browse files
ZzMzawKeats
authored andcommittedFeb 14, 2025
Add pagination info to sections (#2653)
* Add pagination info to get_section * Add documentation for pagination information * Stick to section properties `paginated` attributes removed
1 parent 5bf6adc commit dcae79c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed
 

‎components/content/src/ser.rs

+4
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ pub struct SerializingSection<'a> {
162162
backlinks: Vec<BackLink<'a>>,
163163
generate_feeds: bool,
164164
transparent: bool,
165+
paginate_by: &'a Option<usize>,
166+
paginate_reversed: bool,
165167
}
166168

167169
#[derive(Debug)]
@@ -226,6 +228,8 @@ impl<'a> SerializingSection<'a> {
226228
subsections,
227229
translations,
228230
backlinks,
231+
paginate_by: &section.meta.paginate_by,
232+
paginate_reversed: section.meta.paginate_reversed,
229233
}
230234
}
231235
}

‎docs/content/documentation/templates/pages-sections.md

+8
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,16 @@ backlinks: Array<{permalink: String, title: String?}>;
112112
generate_feeds: bool;
113113
// Whether this section is transparent. Taken from the front-matter if set
114114
transparent: bool;
115+
// How many items per pager (if defined)
116+
paginate_by: Number?;
117+
// If items order is reversed in the pagination (defaults to false)
118+
paginate_reversed: bool;
115119
```
116120
121+
Information about pagination is useful when using the `get_section` Tera function for which the `paginator` is not available.
122+
123+
See [pagination template documentation](@/documentation/templates/pagination.md) for more information on the `paginator` variable.
124+
117125
## Table of contents
118126
119127
Both page and section templates have a `toc` variable that corresponds to an array of `Header`.

0 commit comments

Comments
 (0)