Files
blowfish/layouts/partials/term-link/card.html
Served Smart 1736cafcf4 ♻️ Refactor: Move inline styles containing background-image: out of line
This greatly reduces the number of inline styles in the project and enhances maintainability by avoiding a lot of duplicate code.

This also reduces the number of hashes required for a CSP since all previous background-image inline styles are now in main.css.
2025-06-27 19:21:58 +02:00

49 lines
1.9 KiB
HTML

<a href="{{ .Page.RelPermalink }}" class="min-w-full">
<div
class="border border-neutral-200 dark:border-neutral-700 border-2 rounded overflow-hidden shadow-2xl relative">
{{- with site.Params.images -}}
{{- range first 6 . }}
<meta property="og:image" content="{{ . | absURL }}">
{{ end -}}
{{- else -}}
{{ $images := .Page.Resources.ByType "image" }}
{{ $featuredImage := $images.GetMatch "*feature*" }}
{{ if not $featuredImage }}
{{ $featuredImage = $images.GetMatch "{*cover*,*thumbnail*}" }}
{{ end }}
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
{{ if and ($featuredImage) (not (or ($disableImageOptimization) (strings.HasSuffix $featuredImage.Name ".svg"))) }}
{{ $featuredImage = $featuredImage.Resize "600x" }}
{{ end }}
{{ with $featuredImage }}
{{ $className := printf "background-image-%s" (md5 .RelPermalink) }}
<div class="w-full thumbnail_card_related nozoom {{ $className }}"></div>
{{ else }}
{{ with site.Params.images }}
<meta property="og:image" content="{{ index . 0 | absURL }}" />
{{ end }}
{{ end }}
{{ end }}
{{ if site.Params.taxonomy.showTermCount | default true }}
<span class="absolute bottom-0 right-0 m-2">
<span class="flex">
<span
class="rounded-md border border-primary-400 px-1 py-[1px] text-xl font-normal text-primary-700 dark:border-primary-600 dark:text-primary-400">
{{ .Count }}
</span>
</span>
</span>
{{ end }}
<div class="px-6 py-4">
<div
class="font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral">
{{ .Page.Title | emojify }}
</div>
</div>
<div class="px-6 pt-4 pb-2"></div>
</div>
</a>