Allow using resources for post images
This commit is contained in:
parent
70a7005c7f
commit
0b932a57ef
2 changed files with 7 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: Make QT look less ugly
|
||||
date: 2017-12-27
|
||||
image: /img/qt-gtk-after.png
|
||||
image: resource:qt-gtk-after
|
||||
hide_header_image: true
|
||||
---
|
||||
|
||||
|
|
|
@ -2,7 +2,12 @@
|
|||
{{ if .Params.image }}
|
||||
<div class="d-none d-md-block align-self-center img-wrapper mr-3">
|
||||
<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>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in a new issue