Index

joshstock.in / dc2e4a6

Source for serving and static templating/compiling of https://joshstock.in.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
15814 Jan 2023 23:375aaa26aWebsite rewriteJosh Stockin1290G

Blob @ joshstock.in / site / generators / blog / listing.py

application/x-python905 bytesdownload raw
1import htmlgenerator as hg
2
3
4def run(data):
5 """Build HTML listing for blog article"""
6
7 link = f"/blog/{data.identifier}"
8
9 listing = hg.DIV(
10 hg.A(
11 hg.DIV(
12 style=f"background-image: url({data.banner_image})",
13 ),
14 href=link,
15 _class="blog-banner thumb",
16 ),
17 hg.DIV(
18 hg.P(
19 hg.B(data.datestring, _class="datetime"),
20 hg.I(f"({data.readtime})", _class="readtime", title="at 150wpm"),
21 ),
22 hg.H2(hg.A(data.title, href=link), _class="title"),
23 hg.P(data.description, _class="description"),
24 hg.SPAN(hg.A("Read ", hg.IMG(src="/static/svg/right.svg", _class="inline svg icon"), href=link), style="font-weight:bolder"),
25 _class="blog-listing-container",
26 ),
27 _class="blog-listing",
28 )
29 return listing
30