add option to indicate image copyright for summary preview

This commit is contained in:
Jean-Marie 'Histausse' Mineau 2026-05-01 18:44:23 +02:00
parent e0e86201e6
commit 16d17f7ed7
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2
2 changed files with 12 additions and 3 deletions

View file

@ -23,10 +23,12 @@
}
summary-card-preview {
display: block;
display: flex;
flex-direction: column;
width: 100%;
img {
display: block;
width: 100%;
height: 100%;
object-fit: contain;
@ -54,9 +56,12 @@
}
```
chtml.summary-card({
chtml.summary-card-preview(
chtml.summary-card-preview({
html.a(href: summ.template-args.url, summ.preview-image)
)
if summ.img-copyright != none {
html.small[Image: #sym.copyright #summ.img-copyright]
}
})
chtml.summary-card-description({
heading(level: 2, html.a(href: summ.template-args.url, summ.document-args.title))
@ -79,6 +84,8 @@
/// Right now, this cannot be used for link preview because open graph expect an url for the image, and typst inline
/// the images directly in the html file in base64.
preview-image: none,
/// The copyright for the image
img-copyright: none,
/// The author or authors of the page
author: none,
/// A description of the page
@ -104,6 +111,7 @@
url: url,
),
preview-image: preview-image,
img-copyright: img-copyright,
card: []
)
summ.card = gen_summary_card(summ)

View file

@ -172,6 +172,7 @@ thead {
url: "http://test.example.com",
title: "Card " + str(perm.at(i)),
preview-image: summ.preview-image,
img-copyright: if calc.rem(i, 3) == 0 { [Histausse ] } else { none },
author: "Me!",
description: lorem(10 * calc.rem(i * 123, 10)),
date: datetime(year: 2000, month: 12, day: perm.at(i)),