Browse Source

Do not copy pages of sections when rendering taxonomies

index-subcmd
Vincent Prouillet 6 years ago
parent
commit
6903975202
2 changed files with 23 additions and 1 deletions
  1. +22
    -0
      components/content/src/section.rs
  2. +1
    -1
      components/pagination/src/lib.rs

+ 22
- 0
components/content/src/section.rs 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 {


+ 1
- 1
components/pagination/src/lib.rs 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) => {


Loading…
Cancel
Save