Skip to content

Commit 4b6ccbc

Browse files
committed
feat: set preview image ratio to 1.91 : 1
1 parent ab16fdc commit 4b6ccbc

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

_layouts/post.html

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,14 @@ <h1 data-toc-skip>{{ page.title }}</h1>
3131
{% capture class %}class="preview-img{% if page.image.no_bg %}{{ ' no-bg' }}{% endif %}"{% endcapture %}
3232
{% capture alt %}alt="{{ page.image.alt | default: "Preview Image" }}"{% endcapture %}
3333

34-
{% capture w %}
35-
{% if page.image.width %}
36-
width="{{ page.image.width }}"
37-
{% elsif page.image.w %}
38-
width="{{ page.image.w }}"
39-
{% endif %}
40-
{% endcapture %}
41-
42-
{% capture h %}
43-
{% if page.image.height %}
44-
height="{{ page.image.height }}"
45-
{% elsif page.image.h %}
46-
h="{{ page.image.h }}"
47-
{% endif %}
48-
{% endcapture %}
49-
5034
{% capture lqip %}
5135
{% if page.image.lqip %}
5236
lqip="{{ page.image.lqip }}"
5337
{% endif %}
5438
{% endcapture %}
5539

5640
<div class="mt-3 mb-3">
57-
<img {{ src }} {{ class }} {{ w | strip }} {{ h | strip }} {{ lqip | strip }} {{ alt }}>
41+
<img {{ src }} {{ class }} {{ alt }} w="1200" h="630" {{ lqip | strip }}>
5842
{%- if page.image.alt -%}
5943
<figcaption class="text-center pt-2 pb-2">{{ page.image.alt }}</figcaption>
6044
{%- endif -%}

_sass/layout/post.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,19 @@
3434
@include align-center;
3535
@extend %preview-margin;
3636

37+
max-width: 100%;
38+
3739
&:not(.no-bg) {
3840
img.lazyloaded {
3941
background: var(--img-bg);
4042
}
4143
}
4244

4345
img {
46+
aspect-ratio: 40 / 21;
47+
-o-object-fit: cover;
48+
object-fit: cover;
49+
4450
@extend %preview-margin;
4551
@extend %img-rounded;
4652
}

0 commit comments

Comments
 (0)