From 1875cc9d5c039395a37fa5ac57f163e8871b02e3 Mon Sep 17 00:00:00 2001 From: zyl Date: Wed, 13 Nov 2024 11:12:05 -0800 Subject: [PATCH] automatically pull site name for embed metadata for #1 --- site/pages/docs/pages.md | 4 ---- src/resource.rs | 11 ++--------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/site/pages/docs/pages.md b/site/pages/docs/pages.md index cf4aa48..402d2dc 100644 --- a/site/pages/docs/pages.md +++ b/site/pages/docs/pages.md @@ -47,10 +47,6 @@ table containing the following fields: the custom embed's title. -#### `site_name` - -the site name to use for the embed. - #### `description` the embed's description. optional. diff --git a/src/resource.rs b/src/resource.rs index 7594c2a..9f80da8 100644 --- a/src/resource.rs +++ b/src/resource.rs @@ -68,8 +68,6 @@ impl<'r> ResourceTemplateData<'r> { pub struct EmbedMetadata { pub title: String, #[serde(default)] - pub site_name: String, - #[serde(default)] pub description: Option, #[serde(default)] pub image: Option, @@ -83,12 +81,8 @@ impl EmbedMetadata { /// builds the embed html tags pub fn build(self, builder: &SiteBuilder) -> eyre::Result { let mut s = format!( - r#""#, - self.title, builder.site.config.base_url - ); - s = format!( - r#"{s}"#, - self.site_name + r#""#, + self.title, builder.site.config.base_url, builder.site.config.title, ); if let Some(description) = self.description { s = format!(r#"{s}"#); @@ -261,7 +255,6 @@ impl ResourceBuilder { title: Some(data.title.clone()), embed: Some(EmbedMetadata { title: data.title.clone(), - site_name: builder.site.config.title.clone(), description: data.desc.clone(), image: if let Some(cdn_file) = &data.cdn_file { Some(builder.site.config.cdn_url(cdn_file)?.to_string())