Index

joshstock.in / 29e63dd

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

Latest Commit

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

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

application/x-python1686 bytesdownload raw
1import htmlgenerator as hg
2
3
4def run(data):
5 contents = [
6 hg.DIV(
7 hg.P(hg.A(hg.IMG(src="/static/svg/left.svg", _class="inline svg icon"), " Back", href="/blog"), _class="back-button"),
8 hg.H1(data.title, _class="title"),
9 hg.P(
10 data.description,
11 _class="description",
12 ),
13 hg.P(
14 hg.B(data.datestring, _class="datetime"),
15 hg.I(data.readtime, _class="readtime", title="at 150wpm"),
16 ),
17 _class="blog-metadata",
18 ),
19 hg.DIV(
20 hg.mark_safe(data.content),
21 _class="blog-content",
22 ),
23 hg.DIV(
24 hg.H2("Links", id="links") if len(data.links) > 0 else "",
25 *[
26 hg.P(
27 hg.CODE(link, style="margin-right: 0.5em"),
28 hg.A(data.links[link], href=data.links[link], target="_blank"),
29 )
30 for link in data.links
31 ],
32 hg.P(
33 hg.B("Article hyperlink: "),
34 hg.A(
35 f"https://joshstock.in/blog/{data.identifier}",
36 href=f"/blog/{data.identifier}",
37 ),
38 ),
39 hg.H2("Comments", id="comments"),
40 hg.P(
41 hg.I(
42 "To prevent spam, anonymous comments are held for moderation and may take a few days to appear."
43 )
44 ),
45 hg.DIV(id="commento"),
46 hg.SCRIPT(defer=True, src="https://comments.joshstock.in/js/commento.js"),
47 _class="blog-end",
48 ),
49 ]
50
51 return contents
52