diff --git a/README.md b/README.md index d9def74..bd91866 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ title: README description: the README.md file of this project author: slonkazoid -created_at: 2024-04-18T04:15:26+03:00 +written_at: 2024-04-18T04:15:26+03:00 --- # bingus-blog @@ -83,7 +83,7 @@ author: Blubber256 # author of the post icon: /media/first-post/icon.png # icon/thumbnail of post used in embeds icon_alt: Picture of a computer running DOOM color: "#00aacc" # color of post, also used in embeds -created_at: 2024-04-18T04:15:26+03:00 # date of writing, this is highly +written_at: 2024-04-18T04:15:26+03:00 # date of writing, this is highly # recommended if you are on a system which doesnt have btime (like musl), # because this is fetched from file stats by default #modified_at: ... # see above. this is also fetched from the filesystem @@ -94,7 +94,7 @@ tags: # tags, or keywords, used in meta and also in the ui only first 3 fields are required. if it can't find the other 2 fields, it will get them from filesystem metadata. if you are on musl and you omit the -`created_at` field, it will just not show up +`written_at` field, it will just not show up the dates must follow the [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) standard. examples of valid and invalid dates: diff --git a/src/app.rs b/src/app.rs index 8fbc84f..45795cc 100644 --- a/src/app.rs +++ b/src/app.rs @@ -210,7 +210,7 @@ async fn rss( }) .collect::>(), ) - .pub_date(metadata.created_at.map(|date| date.to_rfc2822())) + .pub_date(metadata.written_at.map(|date| date.to_rfc2822())) .content(content.to_string()) .link( config diff --git a/src/post/blag.rs b/src/post/blag.rs index 9c1ae2a..8ce1272 100644 --- a/src/post/blag.rs +++ b/src/post/blag.rs @@ -33,7 +33,8 @@ struct BlagMetadata { pub icon: Option>, pub icon_alt: Option>, pub color: Option>, - pub created_at: Option>, + #[serde(alias = "created_at")] + pub written_at: Option>, pub modified_at: Option>, #[serde(default)] pub tags: BTreeSet>, @@ -52,7 +53,7 @@ impl BlagMetadata { icon: self.icon, icon_alt: self.icon_alt, color: self.color, - created_at: self.created_at, + written_at: self.written_at, modified_at: self.modified_at, tags: self.tags.into_iter().collect(), }, diff --git a/src/post/markdown_posts.rs b/src/post/markdown_posts.rs index 45e601c..59dd123 100644 --- a/src/post/markdown_posts.rs +++ b/src/post/markdown_posts.rs @@ -37,7 +37,8 @@ struct FrontMatter { pub icon: Option>, pub icon_alt: Option>, pub color: Option>, - pub created_at: Option>, + #[serde(alias = "created_at")] + pub written_at: Option>, pub modified_at: Option>, #[serde(default)] pub tags: BTreeSet>, @@ -58,7 +59,7 @@ impl FrontMatter { icon: self.icon, icon_alt: self.icon_alt, color: self.color, - created_at: self.created_at.or_else(|| created.map(|t| t.into())), + written_at: self.written_at.or_else(|| created.map(|t| t.into())), modified_at: self.modified_at.or_else(|| modified.map(|t| t.into())), tags: self.tags.into_iter().collect(), } diff --git a/src/post/mod.rs b/src/post/mod.rs index 64503b6..94e8866 100644 --- a/src/post/mod.rs +++ b/src/post/mod.rs @@ -26,7 +26,7 @@ pub struct PostMetadata { pub icon: Option>, pub icon_alt: Option>, pub color: Option>, - pub created_at: Option>, + pub written_at: Option>, pub modified_at: Option>, pub tags: Vec>, } @@ -121,7 +121,7 @@ pub trait PostManager { .await?; // we still want some semblance of order if created_at is None so sort by mtime as well posts.sort_unstable_by_key(|metadata| metadata.modified_at.unwrap_or_default()); - posts.sort_by_key(|metadata| metadata.created_at.unwrap_or_default()); + posts.sort_by_key(|metadata| metadata.written_at.unwrap_or_default()); posts.reverse(); if let Some(n) = n { posts.truncate(n);