rename output_path_short and output_path_long, resolves #10

This commit is contained in:
zyl 2024-11-13 11:27:37 -08:00
parent 847f0c7ee7
commit 4c6064a5a1
Signed by: zyl
SSH key fingerprint: SHA256:uxxbSXbdroP/OnKBGnEDk5q7EKB2razvstC/KmzdXXs
4 changed files with 16 additions and 16 deletions

View file

@ -9,8 +9,8 @@ code_theme: base16-ocean.dark # options: base16-ocean.dark, base16-eighties.dark
resources: resources:
blog: blog:
source_path: blog source_path: blog
output_path_short: blog output_path_resources: blog
output_path_long: blog output_path_lists: blog
resource_template: blog/blog.tera resource_template: blog/blog.tera
resource_list_template: blog/list.tera resource_list_template: blog/list.tera
tag_list_template: basic-link-list.tera tag_list_template: basic-link-list.tera

View file

@ -17,13 +17,13 @@ each resource added has its own configuration inside of the main site config fil
the source path for where the resources of this type are located, relative to `<site_path>/resources/`. the source path for where the resources of this type are located, relative to `<site_path>/resources/`.
### `output_path_short` ### `output_path_resources`
the path prefix for a resource, i.e. "blog" for `/blog/<post id>` or "i" for `/i/<image id>`. can be shared with `output_path_long` for them to have the same prefix. the path prefix for a resource, i.e. "blog" for `/blog/<post id>` or "i" for `/i/<image id>`. can be shared with `output_path_lists` for them to have the same prefix.
### `output_path_long` ### `output_path_lists`
the path prefix for other resource pages, like the overview or tags. i.e. "blog" for `/blog/tags/<tag>` or "images" for `/images/tags/<tag>`. can be shared with `output_path_short` for them to have the same prefix. the path prefix for other resource pages, like the overview or tags. i.e. "blog" for `/blog/tags/<tag>` or "images" for `/images/tags/<tag>`. can be shared with `output_path_resources` for them to have the same prefix.
### `resource_template` ### `resource_template`

View file

@ -198,8 +198,8 @@ fn main() -> eyre::Result<()> {
let resource_config = ResourceBuilderConfig { let resource_config = ResourceBuilderConfig {
source_path: id.clone(), source_path: id.clone(),
output_path_short: id.clone(), output_path_resources: id.clone(),
output_path_long: id.clone(), output_path_lists: id.clone(),
resource_template: format!("{id}/resource.tera"), resource_template: format!("{id}/resource.tera"),
resource_list_template: format!("{id}/list.tera"), resource_list_template: format!("{id}/list.tera"),
tag_list_template: "basic-link-list.tera".to_string(), tag_list_template: "basic-link-list.tera".to_string(),

View file

@ -125,9 +125,9 @@ pub struct ResourceBuilderConfig {
/// Path to where the resources should be loaded from. /// Path to where the resources should be loaded from.
pub source_path: String, pub source_path: String,
/// Path to where the resource pages should be written to. /// Path to where the resource pages should be written to.
pub output_path_short: String, pub output_path_resources: String,
/// Path to where the main list should be written to. /// Path to where the main list should be written to.
pub output_path_long: String, pub output_path_lists: String,
/// The template used to render a single resource. /// The template used to render a single resource.
pub resource_template: String, pub resource_template: String,
/// The template used to render a list of resources. /// The template used to render a list of resources.
@ -234,7 +234,7 @@ impl ResourceBuilder {
/// Gets a resource's build path. /// Gets a resource's build path.
fn build_path(&self, base_path: &Path, id: &str) -> PathBuf { fn build_path(&self, base_path: &Path, id: &str) -> PathBuf {
base_path base_path
.join(&self.config.output_path_short) .join(&self.config.output_path_resources)
.join(id) .join(id)
.with_extension("html") .with_extension("html")
} }
@ -279,8 +279,8 @@ impl ResourceBuilder {
} }
pub fn build_all(&self, builder: &SiteBuilder) -> eyre::Result<()> { pub fn build_all(&self, builder: &SiteBuilder) -> eyre::Result<()> {
let out_short = builder.build_path.join(&self.config.output_path_short); let out_short = builder.build_path.join(&self.config.output_path_resources);
let out_long = builder.build_path.join(&self.config.output_path_long); let out_long = builder.build_path.join(&self.config.output_path_lists);
if !out_short.exists() { if !out_short.exists() {
std::fs::create_dir_all(&out_short)?; std::fs::create_dir_all(&out_short)?;
@ -378,7 +378,7 @@ impl ResourceBuilder {
let count = data.len(); let count = data.len();
( (
Link::new( Link::new(
format!("/{}/tag/{tag}/", self.config.output_path_short), format!("/{}/tag/{tag}/", self.config.output_path_resources),
format!("{tag} ({count})"), format!("{tag} ({count})"),
), ),
count, count,
@ -421,7 +421,7 @@ impl ResourceBuilder {
.base_url .base_url
.join(&format!( .join(&format!(
"{}/{}", "{}/{}",
self.config.output_path_short, resource.id self.config.output_path_resources, resource.id
))? ))?
.to_string(), .to_string(),
)) ))
@ -442,7 +442,7 @@ impl ResourceBuilder {
.site .site
.config .config
.base_url .base_url
.join(&format!("{}/", self.config.output_path_long)) .join(&format!("{}/", self.config.output_path_lists))
.expect("Should never fail"), .expect("Should never fail"),
) )
.description(self.config.rss_description.clone()) .description(self.config.rss_description.clone())