mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 15:31:52 +00:00
fix(article-link): skip fetching images when hideFeatureImage is true
This commit is contained in:
@@ -32,24 +32,25 @@
|
|||||||
{{ $articleClasses = delimit (slice $articleClasses "max-w-prose") " " }}
|
{{ $articleClasses = delimit (slice $articleClasses "max-w-prose") " " }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ $images := $target.Resources.ByType "image" }}
|
|
||||||
{{ $featured := "" }}
|
{{ $featured := "" }}
|
||||||
{{ $featuredURL := "" }}
|
{{ $featuredURL := "" }}
|
||||||
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
{{ if not .Params.hideFeatureImage }}
|
||||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
{{ $images := $target.Resources.ByType "image" }}
|
||||||
{{ end }}
|
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
||||||
{{ if and $target.Params.featureimage (not $featured) }}
|
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||||
{{ $url:= $target.Params.featureimage }}
|
{{ end }}
|
||||||
{{ $featured = resources.GetRemote $url }}
|
{{ if and $target.Params.featureimage (not $featured) }}
|
||||||
{{ end }}
|
{{ $url:= $target.Params.featureimage }}
|
||||||
{{ if not $featured }}
|
{{ $featured = resources.GetRemote $url }}
|
||||||
{{ with site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ if not $featured }}
|
||||||
{{ if $target.Params.hideFeatureImage }}{{ $featured = false }}{{ end }}
|
{{ with site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
||||||
{{ with $featured }}
|
{{ end }}
|
||||||
{{ $featuredURL = .RelPermalink }}
|
{{ with $featured }}
|
||||||
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
{{ $featuredURL = .RelPermalink }}
|
||||||
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||||
|
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
*/}}
|
*/}}
|
||||||
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
|
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
|
||||||
|
|
||||||
{{ $images := $.Resources.ByType "image" }}
|
|
||||||
{{ $featured := "" }}
|
{{ $featured := "" }}
|
||||||
{{ $featuredURL := "" }}
|
{{ $featuredURL := "" }}
|
||||||
|
{{ $images := $.Resources.ByType "image" }}
|
||||||
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
||||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
{{ $featured = resources.GetRemote $url }}
|
{{ $featured = resources.GetRemote $url }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if not $featured }}
|
{{ if not $featured }}
|
||||||
{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
{{ with site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ with $featured }}
|
{{ with $featured }}
|
||||||
{{ $featuredURL = .RelPermalink }}
|
{{ $featuredURL = .RelPermalink }}
|
||||||
|
|||||||
@@ -5,24 +5,25 @@
|
|||||||
*/}}
|
*/}}
|
||||||
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
|
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
|
||||||
|
|
||||||
{{ $images := $.Resources.ByType "image" }}
|
|
||||||
{{ $featured := "" }}
|
{{ $featured := "" }}
|
||||||
{{ $featuredURL := "" }}
|
{{ $featuredURL := "" }}
|
||||||
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
{{ if not .Params.hideFeatureImage }}
|
||||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
{{ $images := $.Resources.ByType "image" }}
|
||||||
{{ end }}
|
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
||||||
{{ if and .Params.featureimage (not $featured) }}
|
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||||
{{ $url:= .Params.featureimage }}
|
{{ end }}
|
||||||
{{ $featured = resources.GetRemote $url }}
|
{{ if and .Params.featureimage (not $featured) }}
|
||||||
{{ end }}
|
{{ $url:= .Params.featureimage }}
|
||||||
{{ if not $featured }}
|
{{ $featured = resources.GetRemote $url }}
|
||||||
{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ if not $featured }}
|
||||||
{{ if .Params.hideFeatureImage }}{{ $featured = false }}{{ end }}
|
{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
||||||
{{ with $featured }}
|
{{ end }}
|
||||||
{{ $featuredURL = .RelPermalink }}
|
{{ with $featured }}
|
||||||
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
{{ $featuredURL = .RelPermalink }}
|
||||||
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||||
|
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|||||||
@@ -32,24 +32,25 @@
|
|||||||
{{ $articleClasses = delimit (slice $articleClasses "max-w-prose") " " }}
|
{{ $articleClasses = delimit (slice $articleClasses "max-w-prose") " " }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ $images := $.Resources.ByType "image" }}
|
|
||||||
{{ $featured := "" }}
|
{{ $featured := "" }}
|
||||||
{{ $featuredURL := "" }}
|
{{ $featuredURL := "" }}
|
||||||
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
{{ if not .Params.hideFeatureImage }}
|
||||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
{{ $images := $.Resources.ByType "image" }}
|
||||||
{{ end }}
|
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
||||||
{{ if and .Params.featureimage (not $featured) }}
|
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||||
{{ $url:= .Params.featureimage }}
|
{{ end }}
|
||||||
{{ $featured = resources.GetRemote $url }}
|
{{ if and .Params.featureimage (not $featured) }}
|
||||||
{{ end }}
|
{{ $url:= .Params.featureimage }}
|
||||||
{{ if not $featured }}
|
{{ $featured = resources.GetRemote $url }}
|
||||||
{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ if not $featured }}
|
||||||
{{ if .Params.hideFeatureImage }}{{ $featured = false }}{{ end }}
|
{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
||||||
{{ with $featured }}
|
{{ end }}
|
||||||
{{ $featuredURL = .RelPermalink }}
|
{{ with $featured }}
|
||||||
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
{{ $featuredURL = .RelPermalink }}
|
||||||
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||||
|
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user