mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
Revert "♻️ Refactor: Move inline styles containing background-image: out of line"
This reverts commit 1736cafcf4.
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
{{ $articleImageClasses = delimit (slice $articleImageClasses "thumbnailshadow md:mr-7") " " }}
|
||||
{{ end }}
|
||||
|
||||
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
|
||||
|
||||
{{ $articleInnerClasses := "" }}
|
||||
{{ if .Site.Params.list.showCards }}
|
||||
{{ $articleInnerClasses = delimit (slice $articleInnerClasses "p-4") " " }}
|
||||
@@ -29,36 +31,32 @@
|
||||
<a class="{{ $articleClasses }}" {{ partial "article-link/_external-link.html" . | safeHTMLAttr }}>
|
||||
{{- with $.Params.images -}}
|
||||
{{- range first 6 . }}
|
||||
<meta property="og:image" content="{{ . | absURL }}">
|
||||
{{ end -}}
|
||||
{{- else -}}
|
||||
{{ $images := $.Resources.ByType "image" }}
|
||||
{{ $featuredImage := $images.GetMatch "*feature*" }}
|
||||
{{ if not $featuredImage }}
|
||||
{{ $featuredImage = $images.GetMatch "{*cover*,*thumbnail*}" }}
|
||||
<meta property="og:image" content="{{ . | absURL }}" />{{ end -}}
|
||||
{{- else -}}
|
||||
{{- $images := $.Resources.ByType "image" -}}
|
||||
{{- $featured := $images.GetMatch "*feature*" -}}
|
||||
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
|
||||
{{ if and .Params.featureimage (not $featured) }}
|
||||
{{- $url:= .Params.featureimage -}}
|
||||
{{ $featured = resources.GetRemote $url }}
|
||||
{{ end }}
|
||||
{{ if and (not $featuredImage) .Params.featureimage }}
|
||||
{{ $featuredImage = resources.GetRemote .Params.featureimage }}
|
||||
{{ end }}
|
||||
{{ if not $featuredImage }}
|
||||
{{ $featuredImage = resources.Get .Site.Params.defaultFeaturedImage }}
|
||||
{{ end }}
|
||||
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
|
||||
{{ if and ($featuredImage) (not (or ($disableImageOptimization) (strings.HasSuffix $featuredImage.Name ".svg"))) }}
|
||||
{{ $featuredImage = $featuredImage.Resize "600x" }}
|
||||
{{ end }}
|
||||
{{ if .Params.hideFeatureImage }}
|
||||
{{ $featuredImage = false }}
|
||||
{{ end }}
|
||||
{{ with $featuredImage }}
|
||||
{{ $className := printf "background-image-%s" (md5 .RelPermalink) }}
|
||||
<div class="{{ $articleImageClasses }} {{ $className }}"></div>
|
||||
{{ else }}
|
||||
{{ with $.Site.Params.images }}
|
||||
<meta property="og:image" content="{{ index . 0 | absURL }}">
|
||||
{{- if not $featured }}{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}}
|
||||
{{ if .Params.hideFeatureImage }}{{ $featured = false }}{{ end }}
|
||||
{{- with $featured -}}
|
||||
{{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg")}}
|
||||
{{ with . }}
|
||||
<div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ with .Resize "600x" }}
|
||||
<div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{- else -}}
|
||||
{{- with $.Site.Params.images }}
|
||||
<meta property="og:image" content="{{ index . 0 | absURL }}" />{{ end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<div class="{{ $articleInnerClasses }}">
|
||||
|
||||
Reference in New Issue
Block a user