mirror of
https://github.com/welpo/tabi.git
synced 2026-02-15 23:57:19 +01:00
Remove metadata check to support avif and reduce CLS
This commit is contained in:
parent
7e0f022c92
commit
b5d84f5435
3 changed files with 3 additions and 7 deletions
|
|
@ -18,10 +18,9 @@
|
||||||
<a rel="{{ rel_attributes }}" {{ blank_target }} href="{{ target_url }}" class="card">
|
<a rel="{{ rel_attributes }}" {{ blank_target }} href="{{ target_url }}" class="card">
|
||||||
<div>
|
<div>
|
||||||
{% if page.extra.local_image %}
|
{% if page.extra.local_image %}
|
||||||
{% set meta = get_image_metadata(path=page.extra.local_image, allow_missing=true) %}
|
<img loading="lazy" class="card-image" alt="{{ page.extra.local_image }}" src="{{ get_url(path=page.extra.local_image) }}" width="600px" height="600px">
|
||||||
<img loading="lazy" class="card-image" alt="{{ page.extra.local_image }}" src="{{ get_url(path=page.extra.local_image) }}" {% if meta.width %}width="{{ meta.width }}" {% endif %} {% if meta.height %}height="{{ meta.height }}" {% endif %}>
|
|
||||||
{% elif page.extra.remote_image %}
|
{% elif page.extra.remote_image %}
|
||||||
<img loading="lazy" class="card-image" alt="{{ page.extra.remote_image }}" src="{{ page.extra.remote_image }}">
|
<img loading="lazy" class="card-image" alt="{{ page.extra.remote_image }}" src="{{ page.extra.remote_image }}" width="600px" height="600px">
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="card-image-placeholder"></div>
|
<div class="card-image-placeholder"></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,7 @@
|
||||||
{%- set image_path = get_url(path=header.img, trailing_slash=false) | safe -%}
|
{%- set image_path = get_url(path=header.img, trailing_slash=false) | safe -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
<div id="image-container-home">
|
<div id="image-container-home">
|
||||||
{% set meta = get_image_metadata(path=header.img, allow_missing=true) %}
|
<img fetchpriority="high" alt="{{ header.img_alt | default(value="the owner") }}" id="banner-home-img" src="{{ image_path }}" width="192px" height="192px" />
|
||||||
<img fetchpriority="high" alt="{{ header.img_alt | default(value="the owner") }}" id="banner-home-img" src="{{ image_path }}" {% if meta.width %}width="{{ meta.width }}" {% endif %} {% if meta.height %}height="{{ meta.height }}" {% endif %} />
|
|
||||||
</div>
|
</div>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,9 @@
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{%- set colocated_path = page.colocated_path | default(value="") -%}
|
{%- set colocated_path = page.colocated_path | default(value="") -%}
|
||||||
{%- set relative_path = colocated_path ~ src -%}
|
{%- set relative_path = colocated_path ~ src -%}
|
||||||
{%- set meta = get_image_metadata(path=relative_path, allow_missing=true) -%}
|
|
||||||
|
|
||||||
{#- Fallback to absolute path if relative path doesn't work -#}
|
{#- Fallback to absolute path if relative path doesn't work -#}
|
||||||
{%- if not meta -%}
|
{%- if not meta -%}
|
||||||
{%- set meta = get_image_metadata(path=src, allow_missing=true) -%}
|
|
||||||
{%- set image_url = get_url(path=src) -%}
|
{%- set image_url = get_url(path=src) -%}
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{%- set image_url = get_url(path=relative_path) -%}
|
{%- set image_url = get_url(path=relative_path) -%}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue