Add post title

This commit is contained in:
2025-10-29 17:15:56 +08:00
parent 9d5f86ad46
commit 185d9d4d63
3 changed files with 79 additions and 80 deletions

View File

@@ -171,6 +171,17 @@ fn process_tag(
Ok(post.html_content.clone())
}
"title" => {
let post_name = current_post
.ok_or_else(|| "title tag used outside of post context".to_string())?;
let post = post_manager
.get_post(post_name)
.ok_or_else(|| format!("Post '{}' not found", post_name))?;
Ok(post.title.to_string())
}
"updated" => {
// Insert the last updated time of the current post (or most recent post)
let post_ts = if let Some(p) = current_post {