feat: Enhances image loading with lazy loading

Adds lazy loading attribute to images to improve page load
performance and user experience by deferring the loading
of images until they are in the viewport.

Fixes #44.
This commit is contained in:
Kumi 2024-12-04 14:45:54 +01:00
parent 7715094173
commit 01b63f7a82
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -428,6 +428,9 @@ def wiki_article(
for img in soup.find_all("img"):
img["src"] = get_proxy_url(img["src"])
# While we're at it, ensure that images are loaded lazily
img["loading"] = "lazy"
for source in soup.find_all("source"):
source["src"] = get_proxy_url(source["src"])