This commit is contained in:
ZockerKatze
2025-06-24 10:47:44 +02:00
parent 5ad73485ce
commit fbc41654e0
3 changed files with 32 additions and 4 deletions

View File

@@ -55,8 +55,15 @@ fn get_posts_directory() -> PathBuf {
fn get_file_creation_date(path: &Path) -> std::io::Result<DateTime<Utc>> {
let metadata = fs::metadata(path)?;
let created = metadata.created()?;
Ok(DateTime::<Utc>::from(created))
// Try to get creation time, fall back to modification time if not available
match metadata.created() {
Ok(created) => Ok(DateTime::<Utc>::from(created)),
Err(_) => {
// Fall back to modification time if creation time is not available
let modified = metadata.modified()?;
Ok(DateTime::<Utc>::from(modified))
}
}
}
fn process_anchor_links(content: &str) -> String {