feat: refactor image loading

This commit is contained in:
Cory Dransfeldt 2024-05-01 17:46:07 -07:00
parent 22fd3850ef
commit 93fb7eafeb
No known key found for this signature in database
30 changed files with 3408 additions and 4023 deletions

View file

@ -21,7 +21,11 @@
{%- capture loadingStrategy -%}
{%- if loading -%}{{ loading }}{%- else -%}lazy{%- endif -%}
{%- endcapture -%}
{% image item.image, alt, '', loadingStrategy %}
{% if shape == 'square' %}
<img src="https://coryd.dev/.netlify/images/?url={{ item.image }}&fit=cover&w=320&h=320&fm=webp&q=85" class="image-banner" alt="{{ alt }}" loading="{{ loadingStrategy }}" decoding="async" />
{% else %}
<img src="https://coryd.dev/.netlify/images/?url={{ item.image }}&fit=cover&w=200&h=307&fm=webp&q=85" class="image-banner" alt="{{ alt }}" loading="{{ loadingStrategy }}" decoding="async" />
{% endif %}
</div>
</a>
{% endfor %}

View file

@ -4,7 +4,7 @@
{% capture alt %}{{ item.track | escape }} by {{ item.artist }}{% endcapture %}
<div class="item">
<div class="meta">
{% image item.image, alt, '', 'lazy' %}
<img src="https://coryd.dev/.netlify/images/?url={{ item.image }}&fit=cover&w=64&h=64&fm=webp&q=85" class="image-banner" alt="{{ alt }}" loading="lazy" decoding="async" />
<div class="meta-text">
<div class="title">{{ item.track }}</div>
<div class="subtext">

View file

@ -1,22 +1,24 @@
<div class="badge-grid">
<a href="https://11ty.dev">
{% image './src/assets/img/badges/eleventy.png', 'Made with 11ty', '', 'lazy' %}
<img src="https://coryd.dev/.netlify/images/?url=/assets/img/badges/eleventy.png&fm=webp&q=85" alt="Made with 11ty" loading="lazy" decoding="async" />
</a>
<a href="https://social.lol/@cory">
{% image './src/assets/img/badges/mastodon.png', 'Follow me on Mastodon', '', 'lazy' %}
<img src="https://coryd.dev/.netlify/images/?url=/assets/img/badges/mastodon.png&fm=webp&q=85" alt="Follow me on Mastodon" loading="lazy" decoding="async" />
</a>
<a href="https://github.com/ai-robots-txt/ai.robots.txt">
<img src="https://coryd.dev/.netlify/images/?url=/assets/img/badges/notarobot.png&fm=webp&q=85" alt="Not a robot" loading="lazy" decoding="async" />
</a>
{% image './src/assets/img/badges/notarobot.png', 'Not a robot', '', 'lazy' %}
<a href="https://github.com/cdransf">
{% image './src/assets/img/badges/github.png', 'Check out my GitHub', '', 'lazy' %}
<img src="https://coryd.dev/.netlify/images/?url=/assets/img/badges/github.png&fm=webp&q=85" alt="Check out my GitHub" loading="lazy" decoding="async" />
</a>
<a href="https://www.last.fm/user/coryd_">
{% image './src/assets/img/badges/lastfm.png', 'Follow me on Last.fm', '', 'lazy' %}
<img src="https://coryd.dev/.netlify/images/?url=/assets/img/badges/lastfm.png&fm=webp&q=85" alt="Follow me on Last.fm" loading="lazy" decoding="async" />
</a>
<a href="https://www.buymeacoffee.com/cory">
{% image './src/assets/img/badges/buymeacoffee.png', 'Buy Me a Coffee', '', 'lazy' %}
<img src="https://coryd.dev/.netlify/images/?url=/assets/img/badges/buymeacoffee.png&fm=webp&q=85" alt="Buy Me a Coffee" loading="lazy" decoding="async" />
</a>
{% image './src/assets/img/badges/validhtml5.png', 'Valid HTML5', '', 'lazy' %}
<img src="https://coryd.dev/.netlify/images/?url=/assets/img/badges/validhtml5.png&fm=webp&q=85" alt="Valid HTML5" loading="lazy" decoding="async" />
<a href="https://coryd.dev/feeds">
{% image './src/assets/img/badges/validrss.png', 'Valid RSS', '', 'lazy' %}
<img src="https://coryd.dev/.netlify/images/?url=/assets/img/badges/validrss.png&fm=webp&q=85" alt="Valid RSS" loading="lazy" decoding="async" />
</a>
</div>