From b5aed1e864118929e02997fb3ae155e5ba3e22cc Mon Sep 17 00:00:00 2001 From: WriterV2 Date: Sun, 10 May 2026 22:52:08 +0200 Subject: Update stories page to sort stories by update/upload date --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/main.rs') 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 { ) } - 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())?; } -- cgit v1.2.3