home: finished website articles logic
This commit is contained in:
parent
ac1f9b0023
commit
6dd77e1732
6 changed files with 58 additions and 220 deletions
|
|
@ -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
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue