mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
feat(hero): support internal links for featureimage
This commit also gives the `featureimage` frontmatter the highest priority, preventing it from being overridden by hidden logic.
This commit is contained in:
@@ -1,16 +1,23 @@
|
||||
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
|
||||
|
||||
{{- $images := .Resources.ByType "image" -}}
|
||||
{{- $featured := $images.GetMatch "*background*" -}}
|
||||
{{- if not $featured }}{{ $featured = $images.GetMatch "*feature*" }}{{ end -}}
|
||||
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
|
||||
|
||||
{{ if and .Params.featureimage (not $featured) }}
|
||||
{{- $url:= .Params.featureimage -}}
|
||||
{{ $featured = resources.GetRemote $url }}
|
||||
{{ $featured := "" }}
|
||||
{{ if .Params.featureimage }}
|
||||
{{ $url := .Params.featureimage }}
|
||||
{{ if or (strings.HasPrefix $url "http:") (strings.HasPrefix $url "https:") }}
|
||||
{{ $featured = resources.GetRemote $url }}
|
||||
{{ else }}
|
||||
{{ $featured = resources.Get $url }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{- if not $featured }}
|
||||
{{ if not $featured }}
|
||||
{{ $images := $.Resources.ByType "image" }}
|
||||
{{ range slice "*background*" "*feature*" "*cover*" "*thumbnail*" }}
|
||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if not $featured }}
|
||||
{{ with .Site.Params.defaultBackgroundImage }}
|
||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||
{{ $featured = resources.GetRemote . }}
|
||||
@@ -18,7 +25,7 @@
|
||||
{{ $featured = resources.Get . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
|
||||
{{ $isParentList := eq (.Scratch.Get "scope") "list" }}
|
||||
{{ $shouldBlur := $.Params.layoutBackgroundBlur | default (or
|
||||
|
||||
@@ -1,16 +1,23 @@
|
||||
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
|
||||
|
||||
{{- $images := .Resources.ByType "image" -}}
|
||||
{{- $featured := $images.GetMatch "*background*" -}}
|
||||
{{- if not $featured }}{{ $featured = $images.GetMatch "*feature*" }}{{ end -}}
|
||||
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
|
||||
|
||||
{{ if and .Params.featureimage (not $featured) }}
|
||||
{{- $url:= .Params.featureimage -}}
|
||||
{{ $featured = resources.GetRemote $url }}
|
||||
{{ $featured := "" }}
|
||||
{{ if .Params.featureimage }}
|
||||
{{ $url := .Params.featureimage }}
|
||||
{{ if or (strings.HasPrefix $url "http:") (strings.HasPrefix $url "https:") }}
|
||||
{{ $featured = resources.GetRemote $url }}
|
||||
{{ else }}
|
||||
{{ $featured = resources.Get $url }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{- if not $featured }}
|
||||
{{ if not $featured }}
|
||||
{{ $images := $.Resources.ByType "image" }}
|
||||
{{ range slice "*background*" "*feature*" "*cover*" "*thumbnail*" }}
|
||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if not $featured }}
|
||||
{{ with .Site.Params.defaultBackgroundImage }}
|
||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||
{{ $featured = resources.GetRemote . }}
|
||||
@@ -18,7 +25,7 @@
|
||||
{{ $featured = resources.Get . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
|
||||
{{- with $featured -}}
|
||||
{{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg") }}
|
||||
|
||||
@@ -1,16 +1,23 @@
|
||||
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
|
||||
|
||||
{{- $images := .Resources.ByType "image" -}}
|
||||
{{- $featured := $images.GetMatch "*background*" -}}
|
||||
{{- if not $featured }}{{ $featured = $images.GetMatch "*feature*" }}{{ end -}}
|
||||
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
|
||||
|
||||
{{ $featured := "" }}
|
||||
{{ if .Params.featureimage }}
|
||||
{{- $url:= .Params.featureimage -}}
|
||||
{{- if not $featured }}{{ $featured = resources.GetRemote $url }}{{ end -}}
|
||||
{{ $url := .Params.featureimage }}
|
||||
{{ if or (strings.HasPrefix $url "http:") (strings.HasPrefix $url "https:") }}
|
||||
{{ $featured = resources.GetRemote $url }}
|
||||
{{ else }}
|
||||
{{ $featured = resources.Get $url }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{- if not $featured }}
|
||||
{{ if not $featured }}
|
||||
{{ $images := $.Resources.ByType "image" }}
|
||||
{{ range slice "*background*" "*feature*" "*cover*" "*thumbnail*" }}
|
||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if not $featured }}
|
||||
{{ with .Site.Params.defaultBackgroundImage }}
|
||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||
{{ $featured = resources.GetRemote . }}
|
||||
@@ -18,7 +25,7 @@
|
||||
{{ $featured = resources.Get . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
|
||||
{{ $caption := "" }}
|
||||
{{ if .Params.featureimagecaption }}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
|
||||
|
||||
{{- $images := .Resources.ByType "image" -}}
|
||||
{{- $background := $images.GetMatch "*background*" -}}
|
||||
{{ $images := .Resources.ByType "image" }}
|
||||
{{ $background := $images.GetMatch "*background*" }}
|
||||
|
||||
{{- if not $background }}
|
||||
{{ if not $background }}
|
||||
{{ with .Site.Params.defaultBackgroundImage }}
|
||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||
{{ $background = resources.GetRemote . }}
|
||||
@@ -11,19 +11,30 @@
|
||||
{{ $background = resources.Get . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
|
||||
{{- if not $background }}{{ $background = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
|
||||
{{- if not $background }}{{ $background = $images.GetMatch "*feature*" }}{{ end -}}
|
||||
{{- $featured := $images.GetMatch "*feature*" -}}
|
||||
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
|
||||
{{ if .Params.featureimage }}
|
||||
{{- $url:= .Params.featureimage -}}
|
||||
{{- if not $featured }}{{ $featured = resources.GetRemote $url }}{{ end -}}
|
||||
{{ end }}
|
||||
{{- if not $featured }}{{ $featured = $images.GetMatch "*background*" }}{{ end -}}
|
||||
|
||||
{{- if not $featured }}
|
||||
{{ range slice "*cover*" "*thumbnail*" "*feature*" }}
|
||||
{{ if not $background }}{{ $background = $images.GetMatch . }}{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $featured := "" }}
|
||||
{{ if .Params.featureimage }}
|
||||
{{ $url := .Params.featureimage }}
|
||||
{{ if or (strings.HasPrefix $url "http:") (strings.HasPrefix $url "https:") }}
|
||||
{{ $featured = resources.GetRemote $url }}
|
||||
{{ else }}
|
||||
{{ $featured = resources.Get $url }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if not $featured }}
|
||||
{{ $images := $.Resources.ByType "image" }}
|
||||
{{ range slice "*feature*" "*cover*" "*thumbnail*" "*background*" }}
|
||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if not $featured }}
|
||||
{{ with .Site.Params.defaultFeaturedImage }}
|
||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||
{{ $featured = resources.GetRemote . }}
|
||||
@@ -31,7 +42,7 @@
|
||||
{{ $featured = resources.Get . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
|
||||
{{ $isParentList := eq (.Scratch.Get "scope") "list" }}
|
||||
{{ $shouldBlur := $.Params.layoutBackgroundBlur | default (or
|
||||
|
||||
Reference in New Issue
Block a user