From efb4d16edee1d4d1acf84afdcf4bc4d821e89f78 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Mon, 22 May 2017 20:38:02 +0900 Subject: [PATCH] Remove next/previous page when adding a previous/next to avoid chains Where all the posts would be serialized --- src/content/sorting.rs | 12 ++++++++++-- src/site.rs | 1 - 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/content/sorting.rs b/src/content/sorting.rs index 33fefe71..68a933c7 100644 --- a/src/content/sorting.rs +++ b/src/content/sorting.rs @@ -59,12 +59,20 @@ pub fn populate_previous_and_next_pages(input: &[Page]) -> Vec { 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); } diff --git a/src/site.rs b/src/site.rs index 72c20784..e7c0a0d9 100644 --- a/src/site.rs +++ b/src/site.rs @@ -316,7 +316,6 @@ impl Site { create_directory(¤t_path)?; } } - println!("Rendering page"); // Make sure the folder exists create_directory(¤t_path)?;