Skip to content

Commit

Permalink
refactor!: create Links section in site config
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcur committed May 3, 2024
1 parent aeb2390 commit c2faab5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
#[derive(serde::Deserialize, PartialEq, Eq, Default)]
#[serde(rename_all = "kebab-case", deny_unknown_fields)]
pub struct Links {
pub trim_index_html: Option<bool>,
}

#[derive(serde::Deserialize, PartialEq, Eq)]
#[serde(rename_all = "kebab-case")]
#[serde(rename_all = "kebab-case", deny_unknown_fields)]
pub struct SiteConfig {
pub base_url: String,
pub base_url_develop: String,
pub trim_index_html: Option<bool>,
#[serde(default)]
pub links: Links,
}
2 changes: 1 addition & 1 deletion src/ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl Ctx {
inner: Arc::new(InnerCtx {
build_kind,
base_url: base_url.clone(),
trim_index_html: site_config.trim_index_html.unwrap_or(true),
trim_index_html: site_config.links.trim_index_html.unwrap_or(true),
}),
}
}
Expand Down

0 comments on commit c2faab5

Please sign in to comment.