mirror of
https://gitee.com/butubb8/blowfish.git
synced 2025-12-05 14:17:50 +08: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") " " }}
|
||||
{{ end }}
|
||||
|
||||
{{ $images := $target.Resources.ByType "image" }}
|
||||
{{ $featured := "" }}
|
||||
{{ $featuredURL := "" }}
|
||||
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ if and $target.Params.featureimage (not $featured) }}
|
||||
{{ $url:= $target.Params.featureimage }}
|
||||
{{ $featured = resources.GetRemote $url }}
|
||||
{{ end }}
|
||||
{{ if not $featured }}
|
||||
{{ with site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ if $target.Params.hideFeatureImage }}{{ $featured = false }}{{ end }}
|
||||
{{ with $featured }}
|
||||
{{ $featuredURL = .RelPermalink }}
|
||||
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||
{{ if not .Params.hideFeatureImage }}
|
||||
{{ $images := $target.Resources.ByType "image" }}
|
||||
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ if and $target.Params.featureimage (not $featured) }}
|
||||
{{ $url:= $target.Params.featureimage }}
|
||||
{{ $featured = resources.GetRemote $url }}
|
||||
{{ end }}
|
||||
{{ if not $featured }}
|
||||
{{ with site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ with $featured }}
|
||||
{{ $featuredURL = .RelPermalink }}
|
||||
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
*/}}
|
||||
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
|
||||
|
||||
{{ $images := $.Resources.ByType "image" }}
|
||||
{{ $featured := "" }}
|
||||
{{ $featuredURL := "" }}
|
||||
{{ $images := $.Resources.ByType "image" }}
|
||||
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||
{{ end }}
|
||||
@@ -14,7 +14,7 @@
|
||||
{{ $featured = resources.GetRemote $url }}
|
||||
{{ end }}
|
||||
{{ if not $featured }}
|
||||
{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
||||
{{ with site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ with $featured }}
|
||||
{{ $featuredURL = .RelPermalink }}
|
||||
|
||||
@@ -5,24 +5,25 @@
|
||||
*/}}
|
||||
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
|
||||
|
||||
{{ $images := $.Resources.ByType "image" }}
|
||||
{{ $featured := "" }}
|
||||
{{ $featuredURL := "" }}
|
||||
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ if and .Params.featureimage (not $featured) }}
|
||||
{{ $url:= .Params.featureimage }}
|
||||
{{ $featured = resources.GetRemote $url }}
|
||||
{{ end }}
|
||||
{{ if not $featured }}
|
||||
{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ if .Params.hideFeatureImage }}{{ $featured = false }}{{ end }}
|
||||
{{ with $featured }}
|
||||
{{ $featuredURL = .RelPermalink }}
|
||||
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||
{{ if not .Params.hideFeatureImage }}
|
||||
{{ $images := $.Resources.ByType "image" }}
|
||||
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ if and .Params.featureimage (not $featured) }}
|
||||
{{ $url:= .Params.featureimage }}
|
||||
{{ $featured = resources.GetRemote $url }}
|
||||
{{ end }}
|
||||
{{ if not $featured }}
|
||||
{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ with $featured }}
|
||||
{{ $featuredURL = .RelPermalink }}
|
||||
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
@@ -32,24 +32,25 @@
|
||||
{{ $articleClasses = delimit (slice $articleClasses "max-w-prose") " " }}
|
||||
{{ end }}
|
||||
|
||||
{{ $images := $.Resources.ByType "image" }}
|
||||
{{ $featured := "" }}
|
||||
{{ $featuredURL := "" }}
|
||||
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ if and .Params.featureimage (not $featured) }}
|
||||
{{ $url:= .Params.featureimage }}
|
||||
{{ $featured = resources.GetRemote $url }}
|
||||
{{ end }}
|
||||
{{ if not $featured }}
|
||||
{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ if .Params.hideFeatureImage }}{{ $featured = false }}{{ end }}
|
||||
{{ with $featured }}
|
||||
{{ $featuredURL = .RelPermalink }}
|
||||
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||
{{ if not .Params.hideFeatureImage }}
|
||||
{{ $images := $.Resources.ByType "image" }}
|
||||
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ if and .Params.featureimage (not $featured) }}
|
||||
{{ $url:= .Params.featureimage }}
|
||||
{{ $featured = resources.GetRemote $url }}
|
||||
{{ end }}
|
||||
{{ if not $featured }}
|
||||
{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ with $featured }}
|
||||
{{ $featuredURL = .RelPermalink }}
|
||||
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user