Explorar o código

Look for hero image in page bundle (#684)

Signed-off-by: hossainemruz <hossainemruz@gmail.com>

Signed-off-by: hossainemruz <hossainemruz@gmail.com>
Emruz Hossain %!s(int64=2) %!d(string=hai) anos
pai
achega
c3f0bd449e
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  1. 6 1
      layouts/partials/helpers/get-hero.html

+ 6 - 1
layouts/partials/helpers/get-hero.html

@@ -3,7 +3,12 @@
 
 {{/*  if hero image is specified in the page front-matter, then use that  */}}
 {{ if .Params.hero }}
-  {{ $heroImage = resources.Get .Params.hero }}
+  {{/*  try to read from the page bundle  */}}
+  {{ $heroImage = .Resources.Get .Params.hero }}
+  {{/*  if the image does not exist in the page bundle,try looking in the assets folder  */}}
+  {{ if not $heroImage }}
+    {{ $heroImage = resources.Get .Params.hero }}
+  {{ end }}
 {{ end }}
 {{ .Scratch.Set "heroScratch" $heroImage }}