Skip to content

Commit

Permalink
Do not copy pages of sections when rendering taxonomies
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Prouillet committed Sep 19, 2018
1 parent ccaf36e commit 6903975
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions components/content/src/section.rs
Expand Up @@ -182,6 +182,28 @@ impl Section {
.map(|filename| self.path.clone() + filename)
.collect()
}

pub fn clone_without_pages(&self) -> Section {
let mut subsections = vec![];
for subsection in &self.subsections {
subsections.push(subsection.clone_without_pages());
}

Section {
file: self.file.clone(),
meta: self.meta.clone(),
path: self.path.clone(),
components: self.components.clone(),
permalink: self.permalink.clone(),
raw_content: self.raw_content.clone(),
content: self.content.clone(),
assets: self.assets.clone(),
toc: self.toc.clone(),
subsections,
pages: vec![],
ignored_pages: vec![],
}
}
}

impl ser::Serialize for Section {
Expand Down
2 changes: 1 addition & 1 deletion components/pagination/src/lib.rs
Expand Up @@ -215,7 +215,7 @@ impl<'a> Paginator<'a> {
context.insert("config", &config);
let template_name = match self.root {
PaginationRoot::Section(s) => {
context.insert("section", &s);
context.insert("section", &s.clone_without_pages());
s.get_template_name()
}
PaginationRoot::Taxonomy(t) => {
Expand Down

0 comments on commit 6903975

Please sign in to comment.