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:
@@ -48,18 +48,12 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if $target.Params.hideFeatureImage }}{{ $featured = false }}{{ end }}
|
{{ if $target.Params.hideFeatureImage }}{{ $featured = false }}{{ end }}
|
||||||
{{ with $featured }}
|
{{ with $featured }}
|
||||||
{{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg") }}
|
{{ $featuredURL := .RelPermalink }}
|
||||||
{{ with . }}
|
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||||
<div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div>
|
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||||
{{ end }}
|
|
||||||
{{ else }}
|
|
||||||
{{ with .Resize "600x" }}
|
|
||||||
<div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div>
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
<div class="{{ $articleImageClasses }}" style="background-image:url({{ $featuredURL }});"></div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
<div class="{{ $articleInnerClasses }}">
|
<div class="{{ $articleInnerClasses }}">
|
||||||
<div class="items-center text-start text-xl font-semibold">
|
<div class="items-center text-start text-xl font-semibold">
|
||||||
{{ with $target.Params.externalUrl }}
|
{{ with $target.Params.externalUrl }}
|
||||||
|
|||||||
@@ -17,19 +17,11 @@
|
|||||||
{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ with $featured }}
|
{{ with $featured }}
|
||||||
{{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg") }}
|
{{ $featuredURL := .RelPermalink }}
|
||||||
{{ with . }}
|
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||||
<div
|
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||||
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 }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
<div class="thumbnail_card_related nozoom w-full" style="background-image:url({{ $featuredURL }});"></div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if and .Draft .Site.Params.article.showDraftLabel }}
|
{{ if and .Draft .Site.Params.article.showDraftLabel }}
|
||||||
<span class="absolute top-0 right-0 m-2">
|
<span class="absolute top-0 right-0 m-2">
|
||||||
|
|||||||
@@ -18,15 +18,11 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if .Params.hideFeatureImage }}{{ $featured = false }}{{ end }}
|
{{ if .Params.hideFeatureImage }}{{ $featured = false }}{{ end }}
|
||||||
{{ with $featured }}
|
{{ with $featured }}
|
||||||
{{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg") }}
|
{{ $featuredURL := .RelPermalink }}
|
||||||
{{ with . }}
|
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||||
<div class="thumbnail_card nozoom w-full" style="background-image:url({{ .RelPermalink }});"></div>
|
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||||
{{ end }}
|
|
||||||
{{ else }}
|
|
||||||
{{ with .Resize "600x" }}
|
|
||||||
<div class="thumbnail_card nozoom w-full" style="background-image:url({{ .RelPermalink }});"></div>
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
<div class="thumbnail_card nozoom w-full" style="background-image:url({{ $featuredURL }});"></div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if and .Draft .Site.Params.article.showDraftLabel }}
|
{{ if and .Draft .Site.Params.article.showDraftLabel }}
|
||||||
<span class="absolute top-0 right-0 m-2">
|
<span class="absolute top-0 right-0 m-2">
|
||||||
|
|||||||
@@ -46,18 +46,12 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if .Params.hideFeatureImage }}{{ $featured = false }}{{ end }}
|
{{ if .Params.hideFeatureImage }}{{ $featured = false }}{{ end }}
|
||||||
{{ with $featured }}
|
{{ with $featured }}
|
||||||
{{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg") }}
|
{{ $featuredURL := .RelPermalink }}
|
||||||
{{ with . }}
|
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||||
<div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div>
|
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||||
{{ end }}
|
|
||||||
{{ else }}
|
|
||||||
{{ with .Resize "600x" }}
|
|
||||||
<div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div>
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
<div class="{{ $articleImageClasses }}" style="background-image:url({{ $featuredURL }});"></div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
<div class="{{ $articleInnerClasses }}">
|
<div class="{{ $articleInnerClasses }}">
|
||||||
<div class="items-center text-start text-xl font-semibold">
|
<div class="items-center text-start text-xl font-semibold">
|
||||||
{{ with .Params.externalUrl }}
|
{{ with .Params.externalUrl }}
|
||||||
|
|||||||
Reference in New Issue
Block a user