Set loading=lazy on images.
This commit is contained in:
parent
137f75c42d
commit
c76bfec549
1 changed files with 6 additions and 0 deletions
|
@ -599,6 +599,11 @@ def inject_footnotes(soup):
|
|||
for link in links:
|
||||
link['title'] = texts[link['data-index']]
|
||||
|
||||
def set_img_lazyload(soup):
|
||||
imgs = soup.find_all('img')
|
||||
for img in imgs:
|
||||
img['loading'] = 'lazy'
|
||||
|
||||
# FINAL MARKDOWNS
|
||||
################################################################################
|
||||
def markdown(
|
||||
|
@ -639,6 +644,7 @@ def markdown(
|
|||
fix_classes(soup)
|
||||
fix_reddit_links(soup)
|
||||
inject_footnotes(soup)
|
||||
set_img_lazyload(soup)
|
||||
|
||||
if do_embed_images:
|
||||
embed_images(soup, cache=image_cache)
|
||||
|
|
Loading…
Reference in a new issue