mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
refactor(article-link): unify featured image rendering with MediaType check
This commit is contained in:
@@ -17,19 +17,11 @@
|
||||
{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ with $featured }}
|
||||
{{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg") }}
|
||||
{{ with . }}
|
||||
<div
|
||||
class="thumbnail_card_related nozoom w-full"
|
||||
style="background-image:url({{ .RelPermalink }});"></div>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ with .Resize "600x" }}
|
||||
<div
|
||||
class="thumbnail_card_related nozoom w-full"
|
||||
style="background-image:url({{ .RelPermalink }});"></div>
|
||||
{{ end }}
|
||||
{{ $featuredURL := .RelPermalink }}
|
||||
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||
{{ end }}
|
||||
<div class="thumbnail_card_related nozoom w-full" style="background-image:url({{ $featuredURL }});"></div>
|
||||
{{ end }}
|
||||
{{ if and .Draft .Site.Params.article.showDraftLabel }}
|
||||
<span class="absolute top-0 right-0 m-2">
|
||||
|
||||
Reference in New Issue
Block a user