List three latest articles on index

This commit is contained in:
Reynir Björnsson 2023-11-17 12:32:00 +01:00
parent 24cdc17f3b
commit 96d3069ed1

View file

@ -99,4 +99,11 @@ let generate_contact target =
let generate_index target = let generate_index target =
let* articles = articles in let* articles = articles in
let rec take n xs =
match n, xs with
| 0, _ | _, [] -> []
| _, x :: xs -> x :: take (pred n) xs
in
let open Build in
let articles = articles >>^ take 3 in
with_layout (module Model.Articles) articles "pages/index.md" (index_html target) with_layout (module Model.Articles) articles "pages/index.md" (index_html target)