feat: improve feature image presentation

This commit is contained in:
Friday authored and Nuno C. committed 2026-08-17 20:19:02 +01:00
1 parent 53a64328d7
commit af0e11171c
8 files changed
+49 -14

No files matched your search

+10
View File
@@ -2725,6 +2725,10 @@
--tw-duration: 300ms; --tw-duration: 300ms;
transition-duration: 300ms; transition-duration: 300ms;
} }
.duration-500 {
--tw-duration: 500ms;
transition-duration: 500ms;
}
.duration-\[350ms\] { .duration-\[350ms\] {
--tw-duration: 350ms; --tw-duration: 350ms;
transition-duration: 350ms; transition-duration: 350ms;
@@ -2777,6 +2781,12 @@
.group-hover\:visible:is(:where(.group):hover *) { .group-hover\:visible:is(:where(.group):hover *) {
visibility: visible; visibility: visible;
} }
.group-hover\:scale-105:is(:where(.group):hover *) {
--tw-scale-x: 105%;
--tw-scale-y: 105%;
--tw-scale-z: 105%;
scale: var(--tw-scale-x) var(--tw-scale-y);
}
.group-hover\:scale-110:is(:where(.group):hover *) { .group-hover\:scale-110:is(:where(.group):hover *) {
--tw-scale-x: 110%; --tw-scale-x: 110%;
--tw-scale-y: 110%; --tw-scale-y: 110%;
+1
View File
@@ -109,6 +109,7 @@ fingerprintAlgorithm = "sha512" # Valid values are "sha512" (default), "sha384",
cardView = true cardView = true
cardViewScreenWidth = false cardViewScreenWidth = false
constrainItemsWidth = false constrainItemsWidth = false
featureImageHover = true
[sitemap] [sitemap]
excludedKinds = [] excludedKinds = []
@@ -227,6 +227,7 @@ Many of the article defaults here can be overridden on a per article basis by sp
| Name | Default | Description | | Name | Default | Description |
| --- | --- | --- | | --- | --- | --- |
| `header.layout` | `"basic"` | Defines the header for the entire site, supported values are `basic`, `fixed`, `fixed-fill`, `fixed-fill-blur`, `fixed-gradient`, and `floating`. | | `header.layout` | `"basic"` | Defines the header for the entire site, supported values are `basic`, `fixed`, `fixed-fill`, `fixed-fill-blur`, `fixed-gradient`, and `floating`. |
| `list.featureImageHover` | `false` | Adds a subtle zoom transition when a visitor hovers a post or related-content card. Individual pages can override this with `featureImageHover` in front matter. |
### Footer ### Footer
@@ -34,6 +34,9 @@
{{ $page := $target }} {{ $page := $target }}
{{ $featured := "" }} {{ $featured := "" }}
{{ $featuredURL := "" }} {{ $featuredURL := "" }}
{{ $featureImageHover := site.Params.list.featureImageHover | default false }}
{{ if isset $target.Params "featureImageHover" }}{{ $featureImageHover = $target.Params.featureImageHover }}{{ end }}
{{ $featureImagePosition := $target.Params.imagePositionFeature | default site.Params.imagePositionFeature | default site.Params.imagePosition }}
{{ if not $target.Params.hideFeatureImage }} {{ if not $target.Params.hideFeatureImage }}
{{/* frontmatter */}} {{/* frontmatter */}}
{{ with $page }} {{ with $page }}
@@ -86,15 +89,17 @@
{{ end }} {{ end }}
<article class="article-link--shortcode {{ $cardClasses }}"> <article class="article-link--shortcode group {{ $cardClasses }}">
{{ with $featuredURL }} {{ with $featuredURL }}
<div class="flex-none relative overflow-hidden {{ $imgWrapperClasses }} thumbnail"> <div class="flex-none relative overflow-hidden {{ $imgWrapperClasses }} thumbnail">
<img <img
src="{{ . }}" src="{{ . }}"
role="presentation" alt="{{ $target.Title }}"
loading="lazy" loading="lazy"
decoding="async" decoding="async"
class="not-prose absolute inset-0 w-full h-full object-cover" /> fetchpriority="low"
class="not-prose absolute inset-0 h-full w-full object-cover transition duration-500 {{ if $featureImageHover }}group-hover:scale-105{{ end }}"
{{ with $featureImagePosition }}style="object-position: {{ . }};"{{ end }} />
</div> </div>
{{ end }} {{ end }}
<div class="{{ $cardContentClasses }}"> <div class="{{ $cardContentClasses }}">
@@ -9,6 +9,9 @@
{{ $thumbnailAspectRatio := site.Params.thumbnailAspectRatio | default "1.5" }} {{ $thumbnailAspectRatio := site.Params.thumbnailAspectRatio | default "1.5" }}
{{ $thumbnailAspectRatio = replaceRE "[^0-9.]" "" $thumbnailAspectRatio }} {{ $thumbnailAspectRatio = replaceRE "[^0-9.]" "" $thumbnailAspectRatio }}
{{ if eq $thumbnailAspectRatio "" }}{{ $thumbnailAspectRatio = "1.5" }}{{ end }} {{ if eq $thumbnailAspectRatio "" }}{{ $thumbnailAspectRatio = "1.5" }}{{ end }}
{{ $featureImageHover := site.Params.list.featureImageHover | default false }}
{{ if isset .Params "featureImageHover" }}{{ $featureImageHover = .Params.featureImageHover }}{{ end }}
{{ $featureImagePosition := .Params.imagePositionFeature | default site.Params.imagePositionFeature | default site.Params.imagePosition }}
{{/* frontmatter */}} {{/* frontmatter */}}
{{ with $page }} {{ with $page }}
{{ $p := . }} {{ $p := . }}
@@ -60,18 +63,19 @@
<article <article
class="article-link--related relative min-h-full min-w-full overflow-hidden rounded-lg border border-neutral-300 dark:border-neutral-600"> class="article-link--related group relative min-h-full min-w-full overflow-hidden rounded-lg border border-neutral-300 dark:border-neutral-600">
{{ with $featuredURL }} {{ with $featuredURL }}
<div <div
class="flex-none relative overflow-hidden thumbnail_card_related" class="flex-none relative overflow-hidden thumbnail_card_related"
style="--thumbnail-aspect-ratio: {{ $thumbnailAspectRatio }}"> style="--thumbnail-aspect-ratio: {{ $thumbnailAspectRatio }}">
<img <img
src="{{ . }}" src="{{ . }}"
role="presentation" alt="{{ $page.Title }}"
loading="lazy" loading="lazy"
decoding="async" decoding="async"
fetchpriority="low" fetchpriority="low"
class="not-prose absolute inset-0 w-full h-full object-cover" /> class="not-prose absolute inset-0 h-full w-full object-cover transition duration-500 {{ if $featureImageHover }}group-hover:scale-105{{ end }}"
{{ with $featureImagePosition }}style="object-position: {{ . }};"{{ end }} />
</div> </div>
{{ end }} {{ end }}
{{ if and .Draft .Site.Params.article.showDraftLabel }} {{ if and .Draft .Site.Params.article.showDraftLabel }}
+8 -3
View File
@@ -11,6 +11,9 @@
{{ $thumbnailAspectRatio := site.Params.thumbnailAspectRatio | default "1.5" }} {{ $thumbnailAspectRatio := site.Params.thumbnailAspectRatio | default "1.5" }}
{{ $thumbnailAspectRatio = replaceRE "[^0-9.]" "" $thumbnailAspectRatio }} {{ $thumbnailAspectRatio = replaceRE "[^0-9.]" "" $thumbnailAspectRatio }}
{{ if eq $thumbnailAspectRatio "" }}{{ $thumbnailAspectRatio = "1.5" }}{{ end }} {{ if eq $thumbnailAspectRatio "" }}{{ $thumbnailAspectRatio = "1.5" }}{{ end }}
{{ $featureImageHover := site.Params.list.featureImageHover | default false }}
{{ if isset .Params "featureImageHover" }}{{ $featureImageHover = .Params.featureImageHover }}{{ end }}
{{ $featureImagePosition := .Params.imagePositionFeature | default site.Params.imagePositionFeature | default site.Params.imagePosition }}
{{ if not .Params.hideFeatureImage }} {{ if not .Params.hideFeatureImage }}
{{/* frontmatter */}} {{/* frontmatter */}}
{{ with $page }} {{ with $page }}
@@ -64,17 +67,19 @@
<article <article
class="article-link--card relative min-h-full min-w-full overflow-hidden rounded-lg border border-neutral-300 dark:border-neutral-600"> class="article-link--card group relative min-h-full min-w-full overflow-hidden rounded-lg border border-neutral-300 dark:border-neutral-600">
{{ with $featuredURL }} {{ with $featuredURL }}
<div <div
class="flex-none relative overflow-hidden thumbnail_card" class="flex-none relative overflow-hidden thumbnail_card"
style="--thumbnail-aspect-ratio: {{ $thumbnailAspectRatio }}"> style="--thumbnail-aspect-ratio: {{ $thumbnailAspectRatio }}">
<img <img
src="{{ . }}" src="{{ . }}"
role="presentation" alt="{{ $page.Title }}"
loading="lazy" loading="lazy"
decoding="async" decoding="async"
class="not-prose absolute inset-0 w-full h-full object-cover" /> fetchpriority="low"
class="not-prose absolute inset-0 h-full w-full object-cover transition duration-500 {{ if $featureImageHover }}group-hover:scale-105{{ end }}"
{{ with $featureImagePosition }}style="object-position: {{ . }};"{{ end }} />
</div> </div>
{{ end }} {{ end }}
{{ if and .Draft .Site.Params.article.showDraftLabel }} {{ if and .Draft .Site.Params.article.showDraftLabel }}
+8 -3
View File
@@ -27,6 +27,9 @@
{{ $page := .Page }} {{ $page := .Page }}
{{ $featured := "" }} {{ $featured := "" }}
{{ $featuredURL := "" }} {{ $featuredURL := "" }}
{{ $featureImageHover := site.Params.list.featureImageHover | default false }}
{{ if isset .Params "featureImageHover" }}{{ $featureImageHover = .Params.featureImageHover }}{{ end }}
{{ $featureImagePosition := .Params.imagePositionFeature | default site.Params.imagePositionFeature | default site.Params.imagePosition }}
{{ if not .Params.hideFeatureImage }} {{ if not .Params.hideFeatureImage }}
{{/* frontmatter */}} {{/* frontmatter */}}
{{ with $page }} {{ with $page }}
@@ -79,15 +82,17 @@
{{ end }} {{ end }}
<article class="article-link--simple {{ $cardClasses }}"> <article class="article-link--simple group {{ $cardClasses }}">
{{ with $featuredURL }} {{ with $featuredURL }}
<div class="flex-none relative overflow-hidden {{ $imgWrapperClasses }} thumbnail"> <div class="flex-none relative overflow-hidden {{ $imgWrapperClasses }} thumbnail">
<img <img
src="{{ . }}" src="{{ . }}"
role="presentation" alt="{{ $page.Title }}"
loading="lazy" loading="lazy"
decoding="async" decoding="async"
class="not-prose absolute inset-0 w-full h-full object-cover" /> fetchpriority="low"
class="not-prose absolute inset-0 h-full w-full object-cover transition duration-500 {{ if $featureImageHover }}group-hover:scale-105{{ end }}"
{{ with $featureImagePosition }}style="object-position: {{ . }};"{{ end }} />
</div> </div>
{{ end }} {{ end }}
<div class="{{ $cardContentClasses }}"> <div class="{{ $cardContentClasses }}">
+6 -2
View File
@@ -5,6 +5,9 @@
{{ $thumbnailAspectRatio := site.Params.thumbnailAspectRatio | default "1.5" }} {{ $thumbnailAspectRatio := site.Params.thumbnailAspectRatio | default "1.5" }}
{{ $thumbnailAspectRatio = replaceRE "[^0-9.]" "" $thumbnailAspectRatio }} {{ $thumbnailAspectRatio = replaceRE "[^0-9.]" "" $thumbnailAspectRatio }}
{{ if eq $thumbnailAspectRatio "" }}{{ $thumbnailAspectRatio = "1.5" }}{{ end }} {{ if eq $thumbnailAspectRatio "" }}{{ $thumbnailAspectRatio = "1.5" }}{{ end }}
{{ $featureImageHover := site.Params.list.featureImageHover | default false }}
{{ if isset .Page.Params "featureImageHover" }}{{ $featureImageHover = .Page.Params.featureImageHover }}{{ end }}
{{ $featureImagePosition := .Page.Params.imagePositionFeature | default site.Params.imagePositionFeature | default site.Params.imagePosition }}
{{ $p := .Page }} {{ $p := .Page }}
{{ with .Page.Params.featureimage }} {{ with .Page.Params.featureimage }}
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
@@ -35,7 +38,7 @@
<div class="min-w-full"> <div class="min-w-full">
<div class="border-neutral-200 dark:border-neutral-700 border-2 rounded overflow-hidden shadow-2xl relative"> <div class="group relative overflow-hidden rounded border-2 border-neutral-200 shadow-2xl dark:border-neutral-700">
{{ with $featuredURL }} {{ with $featuredURL }}
<figure <figure
class="not-prose flex-none relative overflow-hidden thumbnail_card" class="not-prose flex-none relative overflow-hidden thumbnail_card"
@@ -46,7 +49,8 @@
loading="lazy" loading="lazy"
decoding="async" decoding="async"
fetchpriority="low" fetchpriority="low"
class="not-prose absolute inset-0 w-full h-full object-cover" /> class="not-prose absolute inset-0 h-full w-full object-cover transition duration-500 {{ if $featureImageHover }}group-hover:scale-105{{ end }}"
{{ with $featureImagePosition }}style="object-position: {{ . }};"{{ end }} />
</figure> </figure>
{{ end }} {{ end }}
{{ if site.Params.taxonomy.showTermCount | default true }} {{ if site.Params.taxonomy.showTermCount | default true }}