home: finished website articles logic

This commit is contained in:
Agahnim 2026-03-23 16:01:10 +01:00
parent a753fd3497
commit 984088b827
6 changed files with 58 additions and 220 deletions

View file

@ -20,11 +20,17 @@ impl AppState {
.expect("p-tracks.json non trouvé"),
)
.expect("JSON invalide"),
website_news: serde_json::from_str(
&std::fs::read_to_string("content/web-articles.json")
.expect("web-articles.json non trouvé"),
)
.expect("JSON invalide"),
website_news: {
let mut news: Vec<WebsiteArticle> = serde_json::from_str(
&std::fs::read_to_string("content/web-articles.json")
.expect("web-articles.json non trouvé"),
)
.expect("JSON invalide");
news.sort_by(|a, b| b.date.cmp(&a.date));
news
},
}
}
}