mirror of
https://github.com/zyllian/zyllian.github.io.git
synced 2025-05-10 10:36:40 -07:00
add embed info to blog posts?
This commit is contained in:
parent
1ef077d6dd
commit
5c93449e58
4 changed files with 60 additions and 8 deletions
|
@ -72,6 +72,10 @@ where
|
|||
fn get_short_desc(&self) -> String;
|
||||
|
||||
fn get_extra_resource_template_data(&self, site_config: &SiteConfig) -> anyhow::Result<E>;
|
||||
|
||||
fn get_head_data(&self, _site_config: &SiteConfig) -> anyhow::Result<String> {
|
||||
Ok(String::new())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
|
@ -84,6 +88,11 @@ struct ResourceListTemplateData<'r, M, E> {
|
|||
next: Option<usize>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
struct ExtraResourceRenderData {
|
||||
head: String,
|
||||
}
|
||||
|
||||
/// Config for the resource builder.
|
||||
#[derive(Debug)]
|
||||
pub struct ResourceBuilderConfig {
|
||||
|
@ -215,12 +224,15 @@ where
|
|||
builder.reg.render(&self.config.resource_template, &data)?
|
||||
};
|
||||
|
||||
let out = builder.build_page_raw(
|
||||
let out = builder.build_page_raw_extra(
|
||||
PageMetadata {
|
||||
title: Some(resource.title.clone()),
|
||||
..Default::default()
|
||||
},
|
||||
&out,
|
||||
ExtraResourceRenderData {
|
||||
head: resource.get_head_data(&builder.site.config)?,
|
||||
},
|
||||
)?;
|
||||
std::fs::write(out_path, out)?;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue