Add a basic template for the blog stream page.
This commit is contained in:
parent
6511115b95
commit
94d9a95967
31
default_environment/templates/html/blog_stream.dust
Normal file
31
default_environment/templates/html/blog_stream.dust
Normal file
@ -0,0 +1,31 @@
|
||||
<div class="blog_stream">
|
||||
{#.children}
|
||||
<div class="blog_stream_post">
|
||||
<div class="blog_post_intro">
|
||||
{?.title}{?.self_link}<a class="blog_post_title" href="{.link}">{.title}</a>{:else}<div class="blog_post_title">{.title}</div>{/.self_link}{/.title}
|
||||
{! TODO: date? !}
|
||||
</div>
|
||||
|
||||
{! TODO: Table of contents? !}
|
||||
|
||||
<div class="blog_post_body">
|
||||
{#.children}
|
||||
{>document_element/}
|
||||
{/.children}
|
||||
|
||||
{?.footnotes}
|
||||
<h2>Footnotes:</h2>
|
||||
{#.footnotes}
|
||||
{>real_footnote_definition/}
|
||||
{/.footnotes}
|
||||
{/.footnotes}
|
||||
</div>
|
||||
</div>
|
||||
{/.children}
|
||||
{#.stream_pagination}
|
||||
<div class="stream_nav">
|
||||
{?.older_link}<a href="{.older_link}">Older</a>{/.older_link}
|
||||
{?.newer_link}<a href="{.newer_link}">Newer</a>{/.newer_link}
|
||||
</div>
|
||||
{/.stream_pagination}
|
||||
</div>
|
@ -11,6 +11,7 @@
|
||||
<div class="main_content">
|
||||
{@select key=.type}
|
||||
{@eq value="blog_post_page"}{>blog_post_page/}{/eq}
|
||||
{@eq value="blog_stream"}{>blog_stream/}{/eq}
|
||||
{@none}{!TODO: make this panic!}ERROR: Unrecognized page content type{/none}
|
||||
{/select}
|
||||
</div>
|
||||
|
@ -19,8 +19,7 @@ pub(crate) struct RenderBlogStream {
|
||||
global_settings: GlobalSettings,
|
||||
page_header: Option<PageHeader>,
|
||||
children: Vec<RenderBlogStreamEntry>,
|
||||
older_link: Option<String>,
|
||||
newer_link: Option<String>,
|
||||
stream_pagination: Option<RenderBlogStreamPagination>,
|
||||
}
|
||||
|
||||
impl RenderBlogStream {
|
||||
@ -64,12 +63,17 @@ impl RenderBlogStream {
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
let stream_pagination = if older_link.is_some() || newer_link.is_some() {
|
||||
Some(RenderBlogStreamPagination::new(older_link, newer_link)?)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Ok(RenderBlogStream {
|
||||
global_settings,
|
||||
page_header: Some(page_header),
|
||||
children,
|
||||
older_link,
|
||||
newer_link,
|
||||
stream_pagination,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -87,7 +91,7 @@ pub(crate) struct RenderBlogStreamEntry {
|
||||
}
|
||||
|
||||
impl RenderBlogStreamEntry {
|
||||
pub(crate) fn new(
|
||||
fn new(
|
||||
config: &Config,
|
||||
output_directory: &Path,
|
||||
output_file: &Path,
|
||||
@ -123,3 +127,21 @@ impl RenderBlogStreamEntry {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub(crate) struct RenderBlogStreamPagination {
|
||||
older_link: Option<String>,
|
||||
newer_link: Option<String>,
|
||||
}
|
||||
|
||||
impl RenderBlogStreamPagination {
|
||||
fn new(
|
||||
older_link: Option<String>,
|
||||
newer_link: Option<String>,
|
||||
) -> Result<RenderBlogStreamPagination, CustomError> {
|
||||
Ok(RenderBlogStreamPagination {
|
||||
older_link,
|
||||
newer_link,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user