mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-11-16 16:05:52 +00:00
feat: global thumbnail aspect ratio configuration
- Add thumbnailAspectRatio site parameter (default '1.5') - Use decimal values instead of fractions for Hugo compatibility - Sanitize user input to extract only numeric characters - Apply to article cards, related cards, and term cards - Update both source and compiled CSS Closes #2839
This commit is contained in:
1 parent
faea1bb046
commit
a308a86365
6 files changed
+22
-7
No files matched your search
@@ -8,6 +8,9 @@
|
||||
{{ $page := .Page }}
|
||||
{{ $featured := "" }}
|
||||
{{ $featuredURL := "" }}
|
||||
{{ $thumbnailAspectRatio := site.Params.thumbnailAspectRatio | default "1.5" }}
|
||||
{{ $thumbnailAspectRatio = replaceRE "[^0-9.]" "" $thumbnailAspectRatio }}
|
||||
{{ if eq $thumbnailAspectRatio "" }}{{ $thumbnailAspectRatio = "1.5" }}{{ end }}
|
||||
{{ if not .Params.hideFeatureImage }}
|
||||
{{/* frontmatter */}}
|
||||
{{ with $page }}
|
||||
@@ -57,7 +60,7 @@
|
||||
<article
|
||||
class="article-link--card relative min-h-full min-w-full overflow-hidden rounded-lg border border-neutral-300 dark:border-neutral-600">
|
||||
{{ with $featuredURL }}
|
||||
<div class="flex-none relative overflow-hidden thumbnail_card">
|
||||
<div class="flex-none relative overflow-hidden thumbnail_card" style="--thumbnail-aspect-ratio: {{ $thumbnailAspectRatio }}">
|
||||
<img
|
||||
src="{{ . }}"
|
||||
role="presentation"
|
||||
|
||||
Reference in new issue
Block a user