Browse Source

Remove next/previous page when adding a previous/next to avoid chains

Where all the posts would be serialized
index-subcmd
Vincent Prouillet 7 years ago
parent
commit
efb4d16ede
2 changed files with 10 additions and 3 deletions
  1. +10
    -2
      src/content/sorting.rs
  2. +0
    -1
      src/site.rs

+ 10
- 2
src/content/sorting.rs View File

@@ -59,12 +59,20 @@ pub fn populate_previous_and_next_pages(input: &[Page]) -> Vec<Page> {

if i > 0 {
let next = &pages[i - 1];
new_page.next = Some(Box::new(next.clone()));
let mut next_page = next.clone();
// Remove prev/next otherwise we serialise the whole thing...
next_page.previous = None;
next_page.next = None;
new_page.next = Some(Box::new(next_page));
}

if i < input.len() - 1 {
let previous = &pages[i + 1];
new_page.previous = Some(Box::new(previous.clone()));
// Remove prev/next otherwise we serialise the whole thing...
let mut previous_page = previous.clone();
previous_page.previous = None;
previous_page.next = None;
new_page.previous = Some(Box::new(previous_page));
}
res.push(new_page);
}


+ 0
- 1
src/site.rs View File

@@ -316,7 +316,6 @@ impl Site {
create_directory(&current_path)?;
}
}
println!("Rendering page");

// Make sure the folder exists
create_directory(&current_path)?;


Loading…
Cancel
Save