Finding the index page.
This commit is contained in:
parent
0a4376dfb8
commit
fdf84e3d0b
@ -99,6 +99,10 @@ impl SiteRenderer {
|
||||
// Steps: for each group, create a RenderBlogStream
|
||||
//
|
||||
// Steps: pass each RenderBlogStream to dust as the context to render index.html and any additional stream pages.
|
||||
|
||||
for blog_post in &self.blog_posts {
|
||||
println!("{:?}", blog_post.get_date()?);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,30 @@ impl BlogPost {
|
||||
}
|
||||
inner(root_dir.as_ref(), post_dir.as_ref()).await
|
||||
}
|
||||
|
||||
/// Get the date for a blog post.
|
||||
///
|
||||
/// The date is set by the "#+date" export setting. This will
|
||||
/// first attempt to read the date from an index.org if such a
|
||||
/// file exists. If that file does not exist or that file does not
|
||||
/// contain a date export setting, then this will iterate through
|
||||
/// all the pages under the blog post looking for any page that
|
||||
/// contains a date export setting. It will return the first date
|
||||
/// found.
|
||||
pub(crate) fn get_date(&self) -> Result<(), CustomError> {
|
||||
if let Some(index_page) = self.get_index_page()? {
|
||||
println!("{:?}", index_page);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get the blog post page for index.org
|
||||
fn get_index_page(&self) -> Result<Option<&BlogPostPage>, CustomError> {
|
||||
Ok(self
|
||||
.pages
|
||||
.iter()
|
||||
.find(|page| page.path == Path::new("index.org")))
|
||||
}
|
||||
}
|
||||
|
||||
async fn read_file(path: PathBuf) -> std::io::Result<(PathBuf, String)> {
|
||||
|
Loading…
Reference in New Issue
Block a user