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:
parent
7715094173
commit
01b63f7a82
1 changed files with 3 additions and 0 deletions
|
@ -428,6 +428,9 @@ def wiki_article(
|
||||||
for img in soup.find_all("img"):
|
for img in soup.find_all("img"):
|
||||||
img["src"] = get_proxy_url(img["src"])
|
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"):
|
for source in soup.find_all("source"):
|
||||||
source["src"] = get_proxy_url(source["src"])
|
source["src"] = get_proxy_url(source["src"])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue