diff options
author | Jordan de la Houssaye <jordan.delahoussaye@gmail.com> | 2020-05-09 19:23:17 +0300 |
---|---|---|
committer | Jordan de la Houssaye <jordan.delahoussaye@gmail.com> | 2020-05-09 19:23:17 +0300 |
commit | 78f40725deca90d1befeda63fca17a3c98a447eb (patch) | |
tree | e87503095fed32bbcdbdf18afe9ae4e1eab20d15 | |
parent | 1c07fa4ae30c3e37f8150d94b5b4d0b1bd844cb3 (diff) |
Fix: featured_image does not work if it is a page resource
-rw-r--r-- | layouts/_default/single.html | 8 | ||||
-rw-r--r-- | layouts/index.html | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index affd53b..22b60a6 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -9,7 +9,11 @@ {{ end }} <div class="{{$post_class}}" - style="background-image: url('{{ $featured_image | absURL}}')"> + {{ if $featured_image }} + {{ $image := .Resources.GetMatch (.Params.featured_image) }} + style="background-image: url('{{$image.Permalink }}')" + {{ end }} + > <div class="post-title"> {{ .Title }} {{ if .Params.description }} @@ -96,4 +100,4 @@ </div> </div> </div> -{{ end }}
\ No newline at end of file +{{ end }} diff --git a/layouts/index.html b/layouts/index.html index c252c53..eaef1f5 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -21,9 +21,10 @@ </div> {{ $featured_image := .Params.featured_image }} {{ if $featured_image }} + {{ $image := .Resources.GetMatch (.Params.featured_image) }} <div class="post-item-image-wrapper"> <div class="post-item-image" - style="background-image: url('{{$featured_image | relLangURL }}')"></div> + style="background-image: url('{{ $image.Permalink }}')"></div> </div> {{ end }} </div> |