Sort card by date in summaries

This commit is contained in:
Jean-Marie 'Histausse' Mineau 2026-04-21 21:38:43 +02:00
parent cdcf69db60
commit e0e86201e6
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2
2 changed files with 10 additions and 4 deletions

View file

@ -130,7 +130,12 @@
lang: "raw-css", lang: "raw-css",
) )
chtml.summary-card-list(attrs: (class: class-name), { chtml.summary-card-list(attrs: (class: class-name), {
for summ in summs { for summ in summs.sorted(key: it =>
-(it.document-args.date.day()-1 + 31 * (
(it.document-args.date.month()-1) +
12 * it.document-args.date.year()
))
) {
summ.card summ.card
} }
}) })

View file

@ -164,16 +164,17 @@ thead {
caption: [A Big Platypus!] caption: [A Big Platypus!]
) )
#let perm = (17, 6, 20, 19, 15, 5, 13, 11, 14, 12, 16, 10, 2, 3, 1, 9, 7, 4, 18, 8)
#card-list( #card-list(
min-width: 200, min-width: 200,
range(1, 21).map(i => range(20).map(i =>
summary( summary(
url: "http://test.example.com", url: "http://test.example.com",
title: "Card " + str(i), title: "Card " + str(perm.at(i)),
preview-image: summ.preview-image, preview-image: summ.preview-image,
author: "Me!", author: "Me!",
description: lorem(10 * calc.rem(i * 123, 10)), description: lorem(10 * calc.rem(i * 123, 10)),
date: datetime(year: 2000, month: 12, day: i), date: datetime(year: 2000, month: 12, day: perm.at(i)),
) )
) )
) )