mirror of
https://gitee.com/butubb8/blowfish.git
synced 2025-12-05 14:17:50 +08:00
🐛 Fix: Typos and images not in css if optimized
This commit is contained in:
@@ -47,29 +47,32 @@
|
||||
{{ end }}
|
||||
|
||||
{{ $images := slice }}
|
||||
{{ $backgroundAndfeaturedImages := slice }}
|
||||
{{ $backgroundAndFeaturedImages := slice }}
|
||||
{{ range .Site.Pages }}
|
||||
{{ $images = $images | append (.Page.Resources.ByType "image") }}
|
||||
{{ if .Params.featureimage }}
|
||||
{{ $backgroundAndfeaturedImages = $backgroundAndfeaturedImages | append (resources.GetRemote .Params.featureimage) }}
|
||||
{{ $backgroundAndFeaturedImages = $backgroundAndFeaturedImages | append (resources.GetRemote .Params.featureimage) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $backgroundAndfeaturedImages = $backgroundAndfeaturedImages | append ($images.Match "{*background*,*feature*,*cover*,*thumbnail*}") }}
|
||||
{{ $backgroundAndFeaturedImages = $backgroundAndFeaturedImages | append ($images.Match "{*background*,*feature*,*cover*,*thumbnail*}") }}
|
||||
{{ $siteParams := slice .Site.Params.defaultFeaturedImage .Site.Params.defaultBackgroundImage }}
|
||||
{{ range $siteParams }}
|
||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||
{{ $backgroundAndfeaturedImages = $backgroundAndfeaturedImages | append (resources.GetRemote .) }}
|
||||
{{ $backgroundAndFeaturedImages = $backgroundAndFeaturedImages | append (resources.GetRemote .) }}
|
||||
{{ else }}
|
||||
{{ $backgroundAndfeaturedImages = $backgroundAndfeaturedImages | append (resources.Get .) }}
|
||||
{{ $backgroundAndFeaturedImages = $backgroundAndFeaturedImages | append (resources.Get .) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
|
||||
{{ range $backgroundAndfeaturedImages }}
|
||||
{{ $backgroundAndfeaturedImages := . }}
|
||||
{{ if not (or ($disableImageOptimization) (strings.HasSuffix .Name ".svg")) }}
|
||||
{{ $backgroundAndfeaturedImages = .Resize "600x" }}
|
||||
{{ range $backgroundAndFeaturedImages }}
|
||||
{{ $images := slice }}
|
||||
{{ if or $disableImageOptimization (strings.HasSuffix .Name ".svg") }}
|
||||
{{ $images = $images | append . }}
|
||||
{{ else }}
|
||||
{{ $images = $images | append (.Resize "600x") }}
|
||||
{{ $images = $images | append (.Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x")) }}
|
||||
{{ end }}
|
||||
{{ with $backgroundAndfeaturedImages }}
|
||||
{{ range $images }}
|
||||
{{ $className := printf "background-image-%s" (md5 .RelPermalink) }}
|
||||
{{ $cssBackgroundImage := printf ".%s { background-image: url(\"%s\"); }" $className .RelPermalink }}
|
||||
{{ $cssBackgroundImage = $cssBackgroundImage | resources.FromString "css/background-image.css" }}
|
||||
|
||||
Reference in New Issue
Block a user