From 0b932a57ef63d3a18fdde3ee6ee5b0e6091ded51 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 4 Jan 2018 10:48:54 +0000 Subject: [PATCH] Allow using resources for post images --- content/posts/make-qt-less-ugly/index.md | 2 +- layouts/partials/list_item.html | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/content/posts/make-qt-less-ugly/index.md b/content/posts/make-qt-less-ugly/index.md index e92977f..6bc49ff 100644 --- a/content/posts/make-qt-less-ugly/index.md +++ b/content/posts/make-qt-less-ugly/index.md @@ -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 --- diff --git a/layouts/partials/list_item.html b/layouts/partials/list_item.html index 1b4f608..bb6bca5 100644 --- a/layouts/partials/list_item.html +++ b/layouts/partials/list_item.html @@ -2,7 +2,12 @@ {{ if .Params.image }}
-
+ {{ .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 }} +
{{ end }}