1
Fork 0

Allow using resources for post images

This commit is contained in:
Jake Howard 2018-01-04 10:48:54 +00:00
parent 70a7005c7f
commit 0b932a57ef
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 7 additions and 2 deletions

View file

@ -1,7 +1,7 @@
--- ---
title: Make QT look less ugly title: Make QT look less ugly
date: 2017-12-27 date: 2017-12-27
image: /img/qt-gtk-after.png image: resource:qt-gtk-after
hide_header_image: true hide_header_image: true
--- ---

View file

@ -2,7 +2,12 @@
{{ if .Params.image }} {{ if .Params.image }}
<div class="d-none d-md-block align-self-center img-wrapper mr-3"> <div class="d-none d-md-block align-self-center img-wrapper mr-3">
<a href="{{ .Permalink }}"> <a href="{{ .Permalink }}">
<div class="image" data-image="{{ .Params.image }}"></div> {{ .Scratch.Set "image" .Params.image }}
{{ if hasPrefix .Params.image "resource:" }}
{{ $resource := .Resources.GetByPrefix (replace .Params.image "resource:" "") }}
{{ .Scratch.Set "image" ($resource.Resize "300x").Permalink }}
{{ end }}
<div class="image" data-image='{{ .Scratch.Get "image" }}'></div>
</a> </a>
</div> </div>
{{ end }} {{ end }}