Fix building blog with zero posts

This commit is contained in:
Mikko Ahlroth 2024-04-14 00:02:29 +03:00
parent f88c5b46fc
commit 246cbe6281

View file

@ -227,7 +227,10 @@ fn pageify_posts(
root_path: String,
extra_header: Element(Nil),
) {
let posts = list.sized_chunk(posts, config.rendering.posts_per_page)
let posts = case posts {
[] -> [[]]
posts -> list.sized_chunk(posts, config.rendering.posts_per_page)
}
let total_pages = list.length(posts)
list.index_map(posts, fn(page_posts, index) {
let page = index + 1