diff options
author | Sean Lane <5761232+seanlane@users.noreply.github.com> | 2021-01-03 19:01:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-03 19:01:22 +0300 |
commit | efa38e90b2cb664fbf497a82049b39724e2821c1 (patch) | |
tree | bc3954b777245c1a9a570d24c288237b13bdd75c | |
parent | a930bd3ffc1d8b9fdfc0ae7cab44a1d9617679c2 (diff) | |
parent | 75eba06d8fffadc75290e2c93a337f59bae1665a (diff) |
Merge pull request #11 from Tiliavir/patch-1
Use image defined in front-matter for the recipe in the overview
-rw-r--r-- | layouts/partials/home.html | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/layouts/partials/home.html b/layouts/partials/home.html index d468b7d..35adabd 100644 --- a/layouts/partials/home.html +++ b/layouts/partials/home.html @@ -4,12 +4,16 @@ {{ range sort (where .Site.RegularPages "Section" "recipes") "Title" }} <div class="sm-col sm-col-6 md-col-6 lg-col-4 xs-px1 xs-mb2"> <a class="block relative bg-blue" href="{{ .RelPermalink }}"> - {{ with .Resources.ByType "image" }} - {{ range first 1 . }} - <div class="image ratio bg-cover" style="background-image:url({{$.Site.BaseURL}}{{ .RelPermalink }});"></div> - {{ end }} + {{ if .Params.Image }} + <div class="image ratio bg-cover" style="background-image:url({{.Permalink}}{{ .Params.Image }});"></div> {{ else }} - <div class="image ratio bg-cover"></div> + {{ with .Resources.ByType "image" }} + {{ range first 1 . }} + <div class="image ratio bg-cover" style="background-image:url({{ .Permalink }});"></div> + {{ end }} + {{ else }} + <div class="image ratio bg-cover"></div> + {{ end }} {{ end }} <h1 class="title p2 m0 absolute white bottom-0 left-0 title-shadow">{{ .Title }}</h1> </a> @@ -46,4 +50,4 @@ {{ .Content }} </div> </div> -</div>
\ No newline at end of file +</div> |