Chunking the blog posts for the stream.
This commit is contained in:
@@ -87,19 +87,26 @@ impl BlogPost {
|
||||
/// 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);
|
||||
pub(crate) fn get_date(&self) -> Option<&str> {
|
||||
let index_page_date = self
|
||||
.get_index_page()
|
||||
.map(|index_page| index_page.date.as_ref().map(String::as_str))
|
||||
.flatten();
|
||||
if index_page_date.is_some() {
|
||||
return index_page_date;
|
||||
}
|
||||
Ok(())
|
||||
|
||||
self.pages
|
||||
.iter()
|
||||
.filter_map(|page| page.date.as_ref().map(String::as_str))
|
||||
.next()
|
||||
}
|
||||
|
||||
/// Get the blog post page for index.org
|
||||
fn get_index_page(&self) -> Result<Option<&BlogPostPage>, CustomError> {
|
||||
Ok(self
|
||||
.pages
|
||||
fn get_index_page(&self) -> Option<&BlogPostPage> {
|
||||
self.pages
|
||||
.iter()
|
||||
.find(|page| page.path == Path::new("index.org")))
|
||||
.find(|page| page.path == Path::new("index.org"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user