Sort articles

This commit is contained in:
Reynir Björnsson 2023-11-14 11:44:51 +01:00
parent c0854750d3
commit 0550bb1227
2 changed files with 7 additions and 1 deletions

View file

@ -67,6 +67,12 @@ module Articles = struct
let make path article = (path, article) let make path article = (path, article)
let sort articles =
List.sort
(fun (_, a) (_, b) ->
~-(Date.compare a.Article.date b.Article.date))
articles
let inject (type a) (module D : Key_value.DESCRIBABLE with type t = a) articles = let inject (type a) (module D : Key_value.DESCRIBABLE with type t = a) articles =
D.[ D.[
"articles", "articles",

View file

@ -76,7 +76,7 @@ let articles =
Metaformat.read_file_with_metadata (module Model.Article) path Metaformat.read_file_with_metadata (module Model.Article) path
>>^ fun (meta, _data) -> >>^ fun (meta, _data) ->
(Model.article_path path, meta)) (Model.article_path path, meta))
(fun articles () -> articles) (fun articles () -> Model.Articles.sort articles)
let generate_archive target = let generate_archive target =
let* articles = articles in let* articles = articles in