Skip to content

Commit

Permalink
optimize thumbnails 16:9
Browse files Browse the repository at this point in the history
  • Loading branch information
klausbreyer committed Jan 30, 2025
1 parent d2cd0f6 commit e2053c0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions layouts/partials/entries-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<li class="flex flex-col overflow-hidden text-lg">
<a href="{{ .Permalink }}" class="flex flex-col h-full hover:opacity-75">
<!-- Bild einfügen -->
{{/* default - what is configured sitewide */}}
{{/* Default - what is configured sitewide */}}
{{ $image := printf "%s%s" .Site.BaseURL .Site.Params.image }}

{{/* next best: take the first image of the article, if any */}}
{{/* Next best: take the first image of the article, if any */}}
{{ range first 1 (.Resources.ByType "image") }}
{{ $image = .Permalink }}
{{ end }}

{{/* if in the post is something defined, this overwrites everything. */}}
{{/* If in the post is something defined, this overwrites everything. */}}
{{ if .Params.image }}
{{ $langPath := print .Lang "/" }}
{{ if eq .Lang "en" }}
Expand All @@ -21,8 +21,8 @@
{{ $image = printf "%s%s%s%s" .Site.BaseURL $langPath .File.Dir .Params.image }}
{{ end }}

<div class="relative h-48">
<img src="{{ $image }}" alt="{{ .Title }}" class="object-cover w-full h-full">
<div class="relative w-full" style="padding-bottom: 56.25%;">
<img src="{{ $image }}" alt="{{ .Title }}" class="absolute top-0 left-0 w-full h-full object-cover">
<time datetime='{{ .Date.Format "2006-01-02" }}' class="absolute px-3 py-1 text-base text-white rounded shadow-sm bg-footer top-2 right-2">
{{ .Date.Format "Jan 02, 2006" }}
</time>
Expand Down

0 comments on commit e2053c0

Please sign in to comment.