diff options
author | Rise <8315221+AmazingRise@users.noreply.github.com> | 2020-05-10 05:33:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-10 05:33:41 +0300 |
commit | 99a2087a8dea1de6278bf382bb6f433fdb09c332 (patch) | |
tree | 0ac33eb81bd73000184d2263a054ac14d4c0cabb | |
parent | 1c07fa4ae30c3e37f8150d94b5b4d0b1bd844cb3 (diff) | |
parent | 5006ee8508d44a340634aa797d6ea5955f1528e4 (diff) |
Merge pull request #33 from jordan-dlh/bug-featured-image
Page resource support for featured_image.
-rw-r--r-- | layouts/_default/single.html | 12 | ||||
-rw-r--r-- | layouts/index.html | 8 |
2 files changed, 17 insertions, 3 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index affd53b..83026c0 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -9,7 +9,15 @@ {{ end }} <div class="{{$post_class}}" - style="background-image: url('{{ $featured_image | absURL}}')"> + {{ if $featured_image }} + {{ $image := .Resources.GetMatch (.Params.featured_image) }} + {{ if $image }} + style="background-image: url('{{$image.Permalink }}')" + {{ else }} + style="background-image: url('{{ $featured_image | absURL}}')" + {{ end }} + {{ end }} + > <div class="post-title"> {{ .Title }} {{ if .Params.description }} @@ -96,4 +104,4 @@ </div> </div> </div> -{{ end }}
\ No newline at end of file +{{ end }} diff --git a/layouts/index.html b/layouts/index.html index c252c53..a61a66d 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -21,9 +21,15 @@ </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> + {{ if $image }} + style="background-image: url('{{ $image.Permalink }}')" + {{ else }} + style="background-image: url('{{ $featured_image | absURL}}')" + {{ end }} + ></div> </div> {{ end }} </div> |