diff options
author | Hugo Aguirre <hugo.agmtz@gmail.com> | 2020-10-19 04:21:59 +0300 |
---|---|---|
committer | Hugo Aguirre <hugo.agmtz@gmail.com> | 2020-10-19 04:21:59 +0300 |
commit | a3a61479560039ce64f112943fa54ee162df9105 (patch) | |
tree | 65357e751bf5ecc11438568a8a905aba890d66c2 | |
parent | 60617b3335d89a1dab05a499c002003ec176140d (diff) |
Get featured image on sidebar using page resources
-rw-r--r-- | layouts/partials/sidebar.html | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 1c5d9f5..155ce70 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -1,7 +1,11 @@ <div class="col-md-4 mt20"> <div class="post-img"> - {{ if .Params.img }} - <img width="600" src="{{ .Site.BaseURL}}images/{{ .Params.img }}" alt="{{ .Params.title }}"> + {{ if .Params.img }} + {{ with .Resources.Match .Params.img }} + {{ range . }} + <img width="100%" src="{{ .RelPermalink }}" alt="{{ .Title }}"> + {{ end }} + {{ end }} {{ else }} <img width="600" src="{{ .Site.BaseURL }}images/{{ .Site.Params.defaultImage }}" alt="webjeda"> {{ end }} |