Browse Source

Do not paginate drafts

Fix #495
index-subcmd
Vincent Prouillet 5 years ago
parent
commit
dc94aa219b
2 changed files with 7 additions and 0 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +6
    -0
      components/library/src/pagination/mod.rs

+ 1
- 0
CHANGELOG.md View File

@@ -35,6 +35,7 @@ sections up to the index to be used with the `get_section` Tera function
- Do not have a trailing slash for the RSS permalinks
- `serve` will now try to find other ports than 1111 rather than panicking
- Ensure content directory exists before rendering aliases
- Do not include drafts in pagination

## 0.4.2 (2018-09-03)



+ 6
- 0
components/library/src/pagination/mod.rs View File

@@ -108,6 +108,9 @@ impl<'a> Paginator<'a> {

for key in self.all_pages {
let page = library.get_page_by_key(*key);
if page.is_draft() {
continue;
}
current_page.push(page.to_serialized_basic(library));

if current_page.len() == self.paginate_by {
@@ -242,6 +245,9 @@ mod tests {
library.insert_page(Page::default());
library.insert_page(Page::default());
library.insert_page(Page::default());
let mut draft = Page::default();
draft.meta.draft = true;
library.insert_page(draft);
let mut section = create_section(is_index);
section.pages = library.pages().keys().collect();
library.insert_section(section.clone());


Loading…
Cancel
Save