aboutsummaryrefslogtreecommitdiffstats
path: root/src/atom.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/atom.rs18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/atom.rs b/src/atom.rs
index 4410edb..a64a6aa 100644
--- a/src/atom.rs
+++ b/src/atom.rs
@@ -68,11 +68,19 @@ pub async fn atom<P: Post + Clone>(ctx: Context, entries: Vec<P>) -> Feed {
.clone()
.into_iter()
.fold(DateTime::<Utc>::MIN_UTC, |acc, entry| {
- let updated_at = entry.updated_at().to_owned();
- if updated_at > acc {
- updated_at
+ if let Some(updated_at) = entry.updated_at() {
+ if *updated_at > acc {
+ *updated_at
+ } else {
+ acc
+ }
} else {
- acc
+ let published_at = entry.published_at();
+ if *published_at > acc {
+ *published_at
+ } else {
+ acc
+ }
}
})
.into(),
@@ -118,7 +126,7 @@ pub async fn atom<P: Post + Clone>(ctx: Context, entries: Vec<P>) -> Feed {
r#type: TextType::Text,
},
id: entry.link(),
- updated: entry.updated_at().to_owned().into(),
+ updated: (*entry.updated_at().unwrap_or_else(|| entry.published_at())).into(),
authors: authors.clone(),
categories,
contributors: authors.clone(),