Do not copy pages of sections when rendering taxonomies

This commit is contained in:
Vincent Prouillet 2018-09-19 09:24:35 +02:00
parent ccaf36ee94
commit 6903975202
2 changed files with 23 additions and 1 deletions

View file

@ -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 {

View file

@ -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) => {