1
Fork 0

Replace GetByPrefix with GetMatch for 0.34 support

This commit is contained in:
Jake Howard 2018-01-24 19:55:48 +00:00
parent 974ba2761c
commit ec4e800750
Signed by: jake
GPG key ID: 57AFB45680EDD477
7 changed files with 8 additions and 7 deletions

View file

@ -10,7 +10,7 @@ jobs:
- checkout
- run:
name: Install Hugo
command: wget https://github.com/gohugoio/hugo/releases/download/v0.32.2/hugo_0.32.2_Linux-64bit.deb -O /tmp/hugo.deb && sudo dpkg -i /tmp/hugo.deb
command: wget https://github.com/gohugoio/hugo/releases/download/v0.34/hugo_0.34_Linux-64bit.deb -O /tmp/hugo.deb && sudo dpkg -i /tmp/hugo.deb
- run:
name: Install dependencies
command: npm install

View file

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

View file

@ -1,7 +1,7 @@
---
title: My Stack - 2017 Edition
date: 2017-12-31
image: resource:editing-my-stack
image: resource:editing-my-stack.png
hide_header_image: true
---

View file

@ -1,7 +1,7 @@
---
title: Why I rewrote my website
date: 2017-11-13
image: resource:new-site-screenshot
image: resource:new-site-screenshot.png
---
I've had a website for around 4 years now, starting with a python CGI-based site hosted at [1&1](https://www.1and1.co.uk/), and evolving into it's current form, powered by [Hugo](https://gohugo.io/).

View file

@ -1,7 +1,7 @@
{{ if .Params.image }}{{ if not .Params.hide_header_image }}
{{ .Scratch.Set "image" .Params.image }}
{{ if hasPrefix .Params.image "resource:" }}
{{ $resource := .Resources.GetByPrefix (replace .Params.image "resource:" "") }}
{{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }}
{{ .Scratch.Set "image" $resource.Permalink }}
{{ end }}
<div class="mb-3 image header-image" data-image='{{ .Scratch.Get "image" }}'></div>

View file

@ -4,7 +4,7 @@
<a href="{{ .Permalink }}">
{{ .Scratch.Set "image" .Params.image }}
{{ if hasPrefix .Params.image "resource:" }}
{{ $resource := .Resources.GetByPrefix (replace .Params.image "resource:" "") }}
{{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }}
{{ .Scratch.Set "image" ($resource.Resize "300x").Permalink }}
{{ end }}
<div class="image" data-image='{{ .Scratch.Get "image" }}'></div>
@ -19,3 +19,4 @@
<p>{{ partial "summary.html" . }}</p>
</div>
</div>

View file

@ -1,4 +1,4 @@
{{ $original := .Page.Resources.GetByPrefix (.Get "src") }}
{{ $original := .Page.Resources.GetMatch (.Get "src") }}
{{ $options := .Get "options" }}
{{ .Scratch.Set "image" $original }}