mirror of
http://nostr-git-proxy.forgejo.svc.cluster.local/git/45387ca441053e230b2126802005eb03767ab59d84555e8bac86b6e7def14e27/bestdadjokes
synced 2026-11-03 07:26:59 +00:00
23 lines
981 B
Python
23 lines
981 B
Python
import sys
|
|
with open('/home/opc/REPOS/bestdadjokes/build.py', 'r') as f:
|
|
lines = f.readlines()
|
|
|
|
start_idx = 290
|
|
end_idx = 291
|
|
|
|
new_code = """ ld = [
|
|
{"@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [
|
|
{"@type": "ListItem", "position": 1, "name": "Home", "item": SITE_URL + '/'},
|
|
{"@type": "ListItem", "position": 2, "name": c['name'], "item": SITE_URL + '/category/%s/' % slug}]},
|
|
{"@context": "https://schema.org", "@type": "ItemList", "itemListElement": [
|
|
{"@type": "ListItem", "position": i + 1, "url": f"{SITE_URL}/#joke-{j['id']}"}
|
|
for i, j in enumerate(js)
|
|
]}
|
|
]
|
|
return layout(title, desc, body, '/category/%s/' % slug,
|
|
'<script type="application/ld+json">%s</script>' % esc(json.dumps(ld)))
|
|
"""
|
|
|
|
lines = lines[:start_idx] + [new_code] + lines[end_idx:]
|
|
with open('/home/opc/REPOS/bestdadjokes/build.py', 'w') as f:
|
|
f.writelines(lines)
|