feat: set preview image ratio to 1.91 : 1

This commit is contained in:
Cotes Chung 2022-12-15 03:18:27 +08:00
parent ab16fdc7fc
commit 4b6ccbcbcc
No known key found for this signature in database
GPG Key ID: 0D9E54843167A808
2 changed files with 7 additions and 17 deletions

View File

@ -31,22 +31,6 @@ tail_includes:
{% capture class %}class="preview-img{% if page.image.no_bg %}{{ ' no-bg' }}{% endif %}"{% endcapture %} {% capture class %}class="preview-img{% if page.image.no_bg %}{{ ' no-bg' }}{% endif %}"{% endcapture %}
{% capture alt %}alt="{{ page.image.alt | default: "Preview Image" }}"{% endcapture %} {% capture alt %}alt="{{ page.image.alt | default: "Preview Image" }}"{% endcapture %}
{% capture w %}
{% if page.image.width %}
width="{{ page.image.width }}"
{% elsif page.image.w %}
width="{{ page.image.w }}"
{% endif %}
{% endcapture %}
{% capture h %}
{% if page.image.height %}
height="{{ page.image.height }}"
{% elsif page.image.h %}
h="{{ page.image.h }}"
{% endif %}
{% endcapture %}
{% capture lqip %} {% capture lqip %}
{% if page.image.lqip %} {% if page.image.lqip %}
lqip="{{ page.image.lqip }}" lqip="{{ page.image.lqip }}"
@ -54,7 +38,7 @@ tail_includes:
{% endcapture %} {% endcapture %}
<div class="mt-3 mb-3"> <div class="mt-3 mb-3">
<img {{ src }} {{ class }} {{ w | strip }} {{ h | strip }} {{ lqip | strip }} {{ alt }}> <img {{ src }} {{ class }} {{ alt }} w="1200" h="630" {{ lqip | strip }}>
{%- if page.image.alt -%} {%- if page.image.alt -%}
<figcaption class="text-center pt-2 pb-2">{{ page.image.alt }}</figcaption> <figcaption class="text-center pt-2 pb-2">{{ page.image.alt }}</figcaption>
{%- endif -%} {%- endif -%}

View File

@ -34,6 +34,8 @@
@include align-center; @include align-center;
@extend %preview-margin; @extend %preview-margin;
max-width: 100%;
&:not(.no-bg) { &:not(.no-bg) {
img.lazyloaded { img.lazyloaded {
background: var(--img-bg); background: var(--img-bg);
@ -41,6 +43,10 @@
} }
img { img {
aspect-ratio: 40 / 21;
-o-object-fit: cover;
object-fit: cover;
@extend %preview-margin; @extend %preview-margin;
@extend %img-rounded; @extend %img-rounded;
} }