Skip to content

Commit

Permalink
Include unrendered pages in sections, add render property to templates
Browse files Browse the repository at this point in the history
  • Loading branch information
clarfonthey committed Oct 10, 2024
1 parent ead17d0 commit 896a805
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions components/content/src/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ impl Library {
.get_mut(&self.taxo_name_to_slug[taxa_name])
.expect("taxa not found");

if !page.meta.render {
continue;
}
if !taxa_def.contains_key(term) {
taxa_def.insert(term.to_string(), Vec::new());
}
Expand Down Expand Up @@ -295,9 +298,6 @@ impl Library {

// Then once we took care of the sections, we find the pages of each section
for (path, page) in self.pages.iter_mut() {
if !page.meta.render {
continue;
}
let parent_filename = &index_filename_by_lang[&page.lang];
add_translation(&page.file.canonical, path);
let mut parent_section_path = page.file.parent.join(parent_filename);
Expand Down
4 changes: 4 additions & 0 deletions components/content/src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ pub struct SerializingPage<'a> {
word_count: Option<usize>,
reading_time: Option<usize>,
assets: &'a [String],
render: bool,
draft: bool,
lang: &'a str,
lower: Option<Box<SerializingPage<'a>>>,
Expand Down Expand Up @@ -128,6 +129,7 @@ impl<'a> SerializingPage<'a> {
word_count: page.word_count,
reading_time: page.reading_time,
assets: &page.serialized_assets,
render: page.meta.render,
draft: page.meta.draft,
lang: &page.lang,
lower,
Expand All @@ -144,6 +146,7 @@ pub struct SerializingSection<'a> {
colocated_path: &'a Option<String>,
content: &'a str,
permalink: &'a str,
render: bool,
draft: bool,
ancestors: &'a [String],
title: &'a Option<String>,
Expand Down Expand Up @@ -207,6 +210,7 @@ impl<'a> SerializingSection<'a> {
relative_path: &section.file.relative,
colocated_path: &section.file.colocated_path,
ancestors: &section.ancestors,
render: section.meta.render,
draft: section.meta.draft,
content: &section.content,
permalink: &section.permalink,
Expand Down
3 changes: 3 additions & 0 deletions docs/content/documentation/templates/pages-sections.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ updated: String?;
slug: String;
path: String;
authors: Array<String>;
render: Bool;
draft: Bool;
// the path, split on '/'
components: Array<String>;
Expand Down Expand Up @@ -77,6 +78,8 @@ content: String;
title: String?;
description: String?;
path: String;
render: Bool;
draft: Bool;
// the path, split on '/'
components: Array<String>;
permalink: String;
Expand Down

0 comments on commit 896a805

Please sign in to comment.