Skip to content

Commit fc13470

Browse files
Mazizovaclaude
andauthored
Blog: stop cropping the sides of cover images (#106)
The list thumbnails were filled to 16:9 although share covers are 1200x630 (about 1.9:1), which cut about 7% off each side. Use a 1200:630 thumbnail box and resize the in-article hero instead of filling it to 16:9. Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent e6560aa commit fc13470

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎assets/scss/_blog.scss‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
.post-card-image {
6262
display: block;
6363
width: 100%;
64-
aspect-ratio: 16 / 9;
64+
// Same ratio as the 1200×630 share covers, so they are not cropped
65+
aspect-ratio: 1200 / 630;
6566
object-fit: cover;
6667
transition: transform 0.3s ease;
6768
}

‎layouts/_default/list.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ <h1>{{ .Title }}</h1>
1717
{{ $imgRes := $page.Resources.Get . }}
1818
{{ if not $imgRes }}{{ $imgRes = resources.Get (strings.TrimPrefix "/" .) }}{{ end }}
1919
{{ with $imgRes }}
20-
{{ $thumb := .Fill "680x382 jpg q85" }}
20+
{{ $thumb := .Fill "680x357 jpg q85" }}
2121
<div class="post-card-image-wrap">
2222
<img src="{{ $thumb.RelPermalink }}" alt="" class="post-card-image" loading="lazy" width="{{ $thumb.Width }}" height="{{ $thumb.Height }}">
2323
</div>

‎layouts/_default/single.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ <h1>{{ .Title }}</h1>
5656
{{ $imgRes := $.Resources.Get . }}
5757
{{ if not $imgRes }}{{ $imgRes = resources.Get (strings.TrimPrefix "/" .) }}{{ end }}
5858
{{ with $imgRes }}
59-
{{ $hero := .Fill "1400x788 jpg q85" }}
59+
{{ $hero := .Resize "1400x jpg q85" }}
6060
<img src="{{ $hero.RelPermalink }}" alt="" class="post-hero-image" width="{{ $hero.Width }}" height="{{ $hero.Height }}">
6161
{{ end }}
6262
{{ end }}

0 commit comments

Comments
 (0)