Lazy load images

This commit is contained in:
spikecodes 2021-09-06 12:02:52 -07:00
parent 6f88fdfc75
commit 52a1b45014
No known key found for this signature in database
GPG key ID: 004CECFF9B463BCB
7 changed files with 89 additions and 92 deletions

View file

@ -63,7 +63,7 @@
xmlns="http://www.w3.org/2000/svg">
<image width="100%" height="100%" href="{{ post.media.url }}"/>
<desc>
<img alt="Post image" src="{{ post.media.url }}"/>
<img loading="lazy" alt="Post image" src="{{ post.media.url }}"/>
</desc>
</svg>
</a>
@ -83,7 +83,7 @@
<div class="gallery">
{% for image in post.gallery -%}
<figure>
<a href="{{ image.url }}" ><img alt="Gallery image" src="{{ image.url }}"/></a>
<a href="{{ image.url }}" ><img loading="lazy" alt="Gallery image" src="{{ image.url }}"/></a>
<figcaption>
<p>{{ image.caption }}</p>
{% if image.outbound_url.len() > 0 %}

View file

@ -34,7 +34,7 @@
<div id="search_subreddits">
{% for subreddit in subreddits %}
<a href="{{ subreddit.url }}" class="search_subreddit">
<div class="search_subreddit_left">{% if subreddit.icon != "" %}<img src="{{ subreddit.icon }}" alt="r/{{ subreddit.name }} icon">{% endif %}</div>
<div class="search_subreddit_left">{% if subreddit.icon != "" %}<img loading="lazy" src="{{ subreddit.icon }}" alt="r/{{ subreddit.name }} icon">{% endif %}</div>
<div class="search_subreddit_right">
<p class="search_subreddit_header">
<span class="search_subreddit_name">{{ subreddit.name }}</span>

View file

@ -78,7 +78,7 @@
</div>
{% endif %}
<div id="sub_meta">
<img id="sub_icon" src="{{ sub.icon }}" alt="Icon for r/{{ sub.name }}">
<img loading="lazy" id="sub_icon" src="{{ sub.icon }}" alt="Icon for r/{{ sub.name }}">
<p id="sub_title">{{ sub.title }}</p>
<p id="sub_name">r/{{ sub.name }}</p>
<p id="sub_description">{{ sub.description }}</p>

View file

@ -68,7 +68,7 @@
</div>
<aside>
<div class="panel" id="user">
<img id="user_icon" src="{{ user.icon }}" alt="User icon">
<img loading="lazy" id="user_icon" src="{{ user.icon }}" alt="User icon">
<p id="user_title">{{ user.title }}</p>
<p id="user_name">u/{{ user.name }}</p>
<div id="user_description">{{ user.description }}</div>

View file

@ -94,7 +94,7 @@
xmlns="http://www.w3.org/2000/svg">
<image width="100%" height="100%" href="{{ post.media.url }}"/>
<desc>
<img alt="Post image" src="{{ post.media.url }}"/>
<img loading="lazy" alt="Post image" src="{{ post.media.url }}"/>
</desc>
</svg>
</a>
@ -121,7 +121,7 @@
<svg width="{{ post.thumbnail.width }}px" height="{{ post.thumbnail.height }}px" xmlns="http://www.w3.org/2000/svg">
<image width="100%" height="100%" href="{{ post.thumbnail.url }}"/>
<desc>
<img alt="Thumbnail" src="{{ post.thumbnail.url }}"/>
<img loading="lazy" alt="Thumbnail" src="{{ post.thumbnail.url }}"/>
</desc>
</svg>
{% endif %}