Chunking the blog posts for the stream.

This commit is contained in:
Tom Alexander
2023-12-17 16:57:37 -05:00
parent fdf84e3d0b
commit c3482cf1e4
6 changed files with 84 additions and 10 deletions

View File

@@ -71,4 +71,13 @@ impl Config {
pub(crate) fn get_site_title(&self) -> Option<&str> {
self.raw.site_title.as_deref()
}
pub(crate) fn get_stream_entries_per_page(&self) -> usize {
self.raw
.stream
.as_ref()
.map(|stream| stream.entries_per_page)
.flatten()
.unwrap_or(5)
}
}

View File

@@ -9,6 +9,7 @@ pub(crate) struct RawConfig {
email: Option<String>,
pub(super) use_relative_paths: Option<bool>,
pub(super) web_root: Option<String>,
pub(super) stream: Option<RawConfigStream>,
}
impl Default for RawConfig {
@@ -19,6 +20,20 @@ impl Default for RawConfig {
email: None,
use_relative_paths: None,
web_root: None,
stream: None,
}
}
}
#[derive(Deserialize, Serialize)]
pub(crate) struct RawConfigStream {
pub(super) entries_per_page: Option<usize>,
}
impl Default for RawConfigStream {
fn default() -> Self {
RawConfigStream {
entries_per_page: None,
}
}
}