2023-10-22 15:31:45 -04:00
|
|
|
use serde::Serialize;
|
|
|
|
|
2023-10-23 21:51:15 -04:00
|
|
|
/// The settings that a "global" to a single dustjs render.
|
|
|
|
#[derive(Debug, Serialize)]
|
|
|
|
pub(crate) struct GlobalSettings {
|
|
|
|
/// The title that goes in the html <title> tag in the <head>.
|
|
|
|
page_title: Option<String>,
|
|
|
|
css_files: Vec<String>,
|
|
|
|
js_files: Vec<String>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl GlobalSettings {
|
|
|
|
pub(crate) fn new(
|
|
|
|
page_title: Option<String>,
|
|
|
|
css_files: Vec<String>,
|
|
|
|
js_files: Vec<String>,
|
|
|
|
) -> GlobalSettings {
|
|
|
|
GlobalSettings {
|
|
|
|
page_title,
|
|
|
|
css_files,
|
|
|
|
js_files,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-22 15:31:45 -04:00
|
|
|
#[derive(Debug, Serialize)]
|
|
|
|
#[serde(tag = "type")]
|
2023-10-23 20:30:43 -04:00
|
|
|
#[serde(rename = "blog_post_page")]
|
|
|
|
pub(crate) struct RenderBlogPostPage {
|
2023-10-23 21:51:15 -04:00
|
|
|
global_settings: GlobalSettings,
|
|
|
|
|
|
|
|
/// The title that will be shown visibly on the page.
|
2023-10-23 20:30:43 -04:00
|
|
|
title: Option<String>,
|
2023-10-23 22:38:00 -04:00
|
|
|
|
|
|
|
self_link: Option<String>,
|
2023-10-23 16:03:37 -04:00
|
|
|
}
|
|
|
|
|
2023-10-23 20:30:43 -04:00
|
|
|
impl RenderBlogPostPage {
|
2023-10-23 21:51:15 -04:00
|
|
|
pub(crate) fn new(
|
|
|
|
global_settings: GlobalSettings,
|
|
|
|
title: Option<String>,
|
2023-10-23 22:38:00 -04:00
|
|
|
self_link: Option<String>,
|
2023-10-23 21:51:15 -04:00
|
|
|
) -> RenderBlogPostPage {
|
|
|
|
RenderBlogPostPage {
|
|
|
|
global_settings,
|
|
|
|
title,
|
2023-10-23 22:38:00 -04:00
|
|
|
self_link,
|
2023-10-23 21:51:15 -04:00
|
|
|
}
|
2023-10-23 16:03:37 -04:00
|
|
|
}
|
2023-10-22 15:31:45 -04:00
|
|
|
}
|