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

Where all the posts would be serialized
This commit is contained in:
Vincent Prouillet 2017-05-22 20:38:02 +09:00
parent dbe4a1d517
commit efb4d16ede
2 changed files with 10 additions and 3 deletions

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);
}

View file

@ -316,7 +316,6 @@ impl Site {
create_directory(&current_path)?;
}
}
println!("Rendering page");
// Make sure the folder exists
create_directory(&current_path)?;