change to written_At
This commit is contained in:
parent
01bc3ae4ae
commit
e6f2c6c697
5 changed files with 12 additions and 10 deletions
|
@ -2,7 +2,7 @@
|
||||||
title: README
|
title: README
|
||||||
description: the README.md file of this project
|
description: the README.md file of this project
|
||||||
author: slonkazoid
|
author: slonkazoid
|
||||||
created_at: 2024-04-18T04:15:26+03:00
|
written_at: 2024-04-18T04:15:26+03:00
|
||||||
---
|
---
|
||||||
|
|
||||||
# bingus-blog
|
# 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: /media/first-post/icon.png # icon/thumbnail of post used in embeds
|
||||||
icon_alt: Picture of a computer running DOOM
|
icon_alt: Picture of a computer running DOOM
|
||||||
color: "#00aacc" # color of post, also used in embeds
|
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),
|
# recommended if you are on a system which doesnt have btime (like musl),
|
||||||
# because this is fetched from file stats by default
|
# because this is fetched from file stats by default
|
||||||
#modified_at: ... # see above. this is also fetched from the filesystem
|
#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
|
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
|
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)
|
the dates must follow the [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339)
|
||||||
standard. examples of valid and invalid dates:
|
standard. examples of valid and invalid dates:
|
||||||
|
|
|
@ -210,7 +210,7 @@ async fn rss(
|
||||||
})
|
})
|
||||||
.collect::<Vec<Category>>(),
|
.collect::<Vec<Category>>(),
|
||||||
)
|
)
|
||||||
.pub_date(metadata.created_at.map(|date| date.to_rfc2822()))
|
.pub_date(metadata.written_at.map(|date| date.to_rfc2822()))
|
||||||
.content(content.to_string())
|
.content(content.to_string())
|
||||||
.link(
|
.link(
|
||||||
config
|
config
|
||||||
|
|
|
@ -33,7 +33,8 @@ struct BlagMetadata {
|
||||||
pub icon: Option<Arc<str>>,
|
pub icon: Option<Arc<str>>,
|
||||||
pub icon_alt: Option<Arc<str>>,
|
pub icon_alt: Option<Arc<str>>,
|
||||||
pub color: Option<Arc<str>>,
|
pub color: Option<Arc<str>>,
|
||||||
pub created_at: Option<DateTime<Utc>>,
|
#[serde(alias = "created_at")]
|
||||||
|
pub written_at: Option<DateTime<Utc>>,
|
||||||
pub modified_at: Option<DateTime<Utc>>,
|
pub modified_at: Option<DateTime<Utc>>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub tags: BTreeSet<Arc<str>>,
|
pub tags: BTreeSet<Arc<str>>,
|
||||||
|
@ -52,7 +53,7 @@ impl BlagMetadata {
|
||||||
icon: self.icon,
|
icon: self.icon,
|
||||||
icon_alt: self.icon_alt,
|
icon_alt: self.icon_alt,
|
||||||
color: self.color,
|
color: self.color,
|
||||||
created_at: self.created_at,
|
written_at: self.written_at,
|
||||||
modified_at: self.modified_at,
|
modified_at: self.modified_at,
|
||||||
tags: self.tags.into_iter().collect(),
|
tags: self.tags.into_iter().collect(),
|
||||||
},
|
},
|
||||||
|
|
|
@ -37,7 +37,8 @@ struct FrontMatter {
|
||||||
pub icon: Option<Arc<str>>,
|
pub icon: Option<Arc<str>>,
|
||||||
pub icon_alt: Option<Arc<str>>,
|
pub icon_alt: Option<Arc<str>>,
|
||||||
pub color: Option<Arc<str>>,
|
pub color: Option<Arc<str>>,
|
||||||
pub created_at: Option<DateTime<Utc>>,
|
#[serde(alias = "created_at")]
|
||||||
|
pub written_at: Option<DateTime<Utc>>,
|
||||||
pub modified_at: Option<DateTime<Utc>>,
|
pub modified_at: Option<DateTime<Utc>>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub tags: BTreeSet<Arc<str>>,
|
pub tags: BTreeSet<Arc<str>>,
|
||||||
|
@ -58,7 +59,7 @@ impl FrontMatter {
|
||||||
icon: self.icon,
|
icon: self.icon,
|
||||||
icon_alt: self.icon_alt,
|
icon_alt: self.icon_alt,
|
||||||
color: self.color,
|
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())),
|
modified_at: self.modified_at.or_else(|| modified.map(|t| t.into())),
|
||||||
tags: self.tags.into_iter().collect(),
|
tags: self.tags.into_iter().collect(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ pub struct PostMetadata {
|
||||||
pub icon: Option<Arc<str>>,
|
pub icon: Option<Arc<str>>,
|
||||||
pub icon_alt: Option<Arc<str>>,
|
pub icon_alt: Option<Arc<str>>,
|
||||||
pub color: Option<Arc<str>>,
|
pub color: Option<Arc<str>>,
|
||||||
pub created_at: Option<DateTime<Utc>>,
|
pub written_at: Option<DateTime<Utc>>,
|
||||||
pub modified_at: Option<DateTime<Utc>>,
|
pub modified_at: Option<DateTime<Utc>>,
|
||||||
pub tags: Vec<Arc<str>>,
|
pub tags: Vec<Arc<str>>,
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ pub trait PostManager {
|
||||||
.await?;
|
.await?;
|
||||||
// we still want some semblance of order if created_at is None so sort by mtime as well
|
// 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_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();
|
posts.reverse();
|
||||||
if let Some(n) = n {
|
if let Some(n) = n {
|
||||||
posts.truncate(n);
|
posts.truncate(n);
|
||||||
|
|
Loading…
Reference in a new issue