Add publish filter to blog posts and pages.
This commit is contained in:
parent
fa8753077a
commit
d2256b8333
@ -85,7 +85,11 @@ impl SiteRenderer {
|
|||||||
pub(crate) async fn render_pages(&self, config: &Config) -> Result<(), CustomError> {
|
pub(crate) async fn render_pages(&self, config: &Config) -> Result<(), CustomError> {
|
||||||
let renderer_integration = self.init_renderer_integration()?;
|
let renderer_integration = self.init_renderer_integration()?;
|
||||||
|
|
||||||
for page in &self.pages {
|
for page in self.pages.iter().filter(|page| match page.natter_publish {
|
||||||
|
PublishStatus::Full => true,
|
||||||
|
PublishStatus::Unlisted => true,
|
||||||
|
PublishStatus::Unpublished => false,
|
||||||
|
}) {
|
||||||
let output_path = self.output_directory.join(page.get_output_path());
|
let output_path = self.output_directory.join(page.get_output_path());
|
||||||
let dependency_manager =
|
let dependency_manager =
|
||||||
std::sync::Arc::new(std::sync::Mutex::new(DependencyManager::new()));
|
std::sync::Arc::new(std::sync::Mutex::new(DependencyManager::new()));
|
||||||
@ -116,7 +120,17 @@ impl SiteRenderer {
|
|||||||
pub(crate) async fn render_blog_posts(&self, config: &Config) -> Result<(), CustomError> {
|
pub(crate) async fn render_blog_posts(&self, config: &Config) -> Result<(), CustomError> {
|
||||||
let renderer_integration = self.init_renderer_integration()?;
|
let renderer_integration = self.init_renderer_integration()?;
|
||||||
|
|
||||||
for blog_post in &self.blog_posts {
|
for blog_post in self.blog_posts.iter().filter(|blog_post| {
|
||||||
|
match blog_post
|
||||||
|
.get_index_page()
|
||||||
|
.expect("Blog posts should have an index page.")
|
||||||
|
.natter_publish
|
||||||
|
{
|
||||||
|
PublishStatus::Full => true,
|
||||||
|
PublishStatus::Unlisted => true,
|
||||||
|
PublishStatus::Unpublished => false,
|
||||||
|
}
|
||||||
|
}) {
|
||||||
for blog_post_page in &blog_post.pages {
|
for blog_post_page in &blog_post.pages {
|
||||||
let output_path = self
|
let output_path = self
|
||||||
.output_directory
|
.output_directory
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
use super::blog_post_page::get_date;
|
use super::blog_post_page::get_date;
|
||||||
|
use super::blog_post_page::get_publish_status;
|
||||||
use super::blog_post_page::get_title;
|
use super::blog_post_page::get_title;
|
||||||
use super::footnote_definition::IRealFootnoteDefinition;
|
use super::footnote_definition::IRealFootnoteDefinition;
|
||||||
use super::macros::intermediate;
|
use super::macros::intermediate;
|
||||||
use super::IDocumentElement;
|
use super::IDocumentElement;
|
||||||
use super::IHeading;
|
use super::IHeading;
|
||||||
use super::ISection;
|
use super::ISection;
|
||||||
|
use super::PublishStatus;
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
@ -24,6 +26,8 @@ pub(crate) struct IPage {
|
|||||||
pub(crate) children: Vec<IDocumentElement>,
|
pub(crate) children: Vec<IDocumentElement>,
|
||||||
|
|
||||||
pub(crate) footnotes: Vec<IRealFootnoteDefinition>,
|
pub(crate) footnotes: Vec<IRealFootnoteDefinition>,
|
||||||
|
|
||||||
|
pub(crate) natter_publish: PublishStatus,
|
||||||
}
|
}
|
||||||
|
|
||||||
intermediate!(
|
intermediate!(
|
||||||
@ -69,6 +73,7 @@ intermediate!(
|
|||||||
date: get_date(original.document),
|
date: get_date(original.document),
|
||||||
children,
|
children,
|
||||||
footnotes,
|
footnotes,
|
||||||
|
natter_publish: get_publish_status(original.document).unwrap_or_default(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user