If its not a markdown file just return the file name itself, because then it's probably a directory.

This commit is contained in:
2025-05-04 00:37:12 -05:00
parent 9e44884dde
commit e4d8f9c8e8

View File

@@ -321,7 +321,12 @@ fn render_markdown (content: &tera::Value, args: &HashMap<String, tera::Value>)
} }
fn file_stem (content: &tera::Value, args: &HashMap<String, tera::Value>) -> tera::Result<tera::Value> { fn file_stem (content: &tera::Value, args: &HashMap<String, tera::Value>) -> tera::Result<tera::Value> {
Ok(tera::Value::String(Path::new(content.as_str().expect("as_str")).file_stem().expect("file_stem").to_str().expect("to_str").to_owned())) let content_as_str = content.as_str().expect("as_str");
if !content_as_str.ends_with(MD_EXTENSION) {
Ok(content.clone())
} else {
Ok(tera::Value::String(Path::new(content_as_str).file_stem().expect("file_stem").to_str().expect("to_str").to_owned()))
}
} }
impl PageRenderer { impl PageRenderer {