diff options
| author | WriterV2 <primary-v2@protonmail.com> | 2026-05-10 22:52:08 +0200 |
|---|---|---|
| committer | WriterV2 <primary-v2@protonmail.com> | 2026-05-10 22:52:08 +0200 |
| commit | b5aed1e864118929e02997fb3ae155e5ba3e22cc (patch) | |
| tree | 38b9fc810d593c1b2aced044a3c73f4940c0de92 /src/main.rs | |
| parent | 633f86e11aaa33de461627a18312f7d21e04182c (diff) | |
Update stories page to sort stories by update/upload date
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index b1312ad..ec38670 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,7 +25,12 @@ impl page::Page for Vec<Story> { ) } - fn prepare_content(&self) -> Result<()> { + fn prepare_content(&mut self) -> Result<()> { + self.sort_by(|a, b| { + let date1 = a.update_date.unwrap_or(a.upload_date); + let date2 = b.update_date.unwrap_or(b.upload_date); + date2.cmp(&date1) + }); for story in self { std::fs::copy(&story.path, story.format_local_pdf_path())?; } |
