Allow unsplash images to be used
Oh my god Go templates are horrible!
This commit is contained in:
parent
532baca63e
commit
f311220fe2
6 changed files with 18 additions and 0 deletions
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
|
@ -5,6 +5,7 @@ on: [push, pull_request]
|
||||||
env:
|
env:
|
||||||
FLICKR_API_KEY: ${{ secrets.FLICKR_API_KEY }}
|
FLICKR_API_KEY: ${{ secrets.FLICKR_API_KEY }}
|
||||||
FLICKR_USER_ID: ${{ secrets.FLICKR_USER_ID }}
|
FLICKR_USER_ID: ${{ secrets.FLICKR_USER_ID }}
|
||||||
|
UNSPLASH_API_KEY: ${{ secrets.UNSPLASH_API_KEY }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
|
|
1
.github/workflows/deploy.yml
vendored
1
.github/workflows/deploy.yml
vendored
|
@ -8,6 +8,7 @@ on:
|
||||||
env:
|
env:
|
||||||
FLICKR_API_KEY: ${{ secrets.FLICKR_API_KEY }}
|
FLICKR_API_KEY: ${{ secrets.FLICKR_API_KEY }}
|
||||||
FLICKR_USER_ID: ${{ secrets.FLICKR_USER_ID }}
|
FLICKR_USER_ID: ${{ secrets.FLICKR_USER_ID }}
|
||||||
|
UNSPLASH_API_KEY: ${{ secrets.UNSPLASH_API_KEY }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
title: Installing Arch from scratch on Kimsufi
|
title: Installing Arch from scratch on Kimsufi
|
||||||
date: 2020-08-29
|
date: 2020-08-29
|
||||||
tags: [arch, linux, self-hosting]
|
tags: [arch, linux, self-hosting]
|
||||||
|
image: unsplash:Tjbk79TARiE
|
||||||
---
|
---
|
||||||
|
|
||||||
Recently, I bought myself a new server from [Kimsufi](https://kimsufi.com/), to function as an off-site backup server. And after fighting with both their management interface and customer services, I finally got it booted. Kimsufi have a respectable list of OS options, however not especially recent. The latest version of Ubuntu they have is 16.04, and the Arch installer is based on an image from 2018.
|
Recently, I bought myself a new server from [Kimsufi](https://kimsufi.com/), to function as an off-site backup server. And after fighting with both their management interface and customer services, I finally got it booted. Kimsufi have a respectable list of OS options, however not especially recent. The latest version of Ubuntu they have is 16.04, and the Arch installer is based on an image from 2018.
|
||||||
|
|
|
@ -3,6 +3,11 @@
|
||||||
{{ if hasPrefix .Params.image "resource:" }}
|
{{ if hasPrefix .Params.image "resource:" }}
|
||||||
{{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }}
|
{{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }}
|
||||||
{{ .Scratch.Set "image" ($resource.Resize "2000x").RelPermalink }}
|
{{ .Scratch.Set "image" ($resource.Resize "2000x").RelPermalink }}
|
||||||
|
{{ else if hasPrefix .Params.image "unsplash:" }}
|
||||||
|
{{ $unsplash_id := replace .Params.image "unsplash:" "" }}
|
||||||
|
{{ $query := querify "client_id" (getenv "UNSPLASH_ACCESS_KEY") }}
|
||||||
|
{{ $unsplash_data := (getJSON "https://api.unsplash.com/photos/" $unsplash_id "?" $query )}}
|
||||||
|
{{ .Scratch.Set "image" $unsplash_data.urls.full }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<div class="mb-3 image header-image" data-image='{{ .Scratch.Get "image" }}'></div>
|
<div class="mb-3 image header-image" data-image='{{ .Scratch.Get "image" }}'></div>
|
||||||
|
|
|
@ -6,6 +6,11 @@
|
||||||
{{ if hasPrefix .Params.image "resource:" }}
|
{{ if hasPrefix .Params.image "resource:" }}
|
||||||
{{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }}
|
{{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }}
|
||||||
{{ .Scratch.Set "image" ($resource.Resize "500x").RelPermalink }}
|
{{ .Scratch.Set "image" ($resource.Resize "500x").RelPermalink }}
|
||||||
|
{{ else if hasPrefix .Params.image "unsplash:" }}
|
||||||
|
{{ $unsplash_id := replace .Params.image "unsplash:" "" }}
|
||||||
|
{{ $query := querify "client_id" (getenv "UNSPLASH_ACCESS_KEY") }}
|
||||||
|
{{ $unsplash_data := (getJSON "https://api.unsplash.com/photos/" $unsplash_id "?" $query )}}
|
||||||
|
{{ .Scratch.Set "image" $unsplash_data.urls.thumb }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<div class="image" data-image='{{ .Scratch.Get "image" }}'></div>
|
<div class="image" data-image='{{ .Scratch.Get "image" }}'></div>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -3,6 +3,11 @@
|
||||||
{{ if hasPrefix .Params.image "resource:" }}
|
{{ if hasPrefix .Params.image "resource:" }}
|
||||||
{{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }}
|
{{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }}
|
||||||
{{ .Scratch.Set "image" ($resource.Fill "800x418").Permalink }}
|
{{ .Scratch.Set "image" ($resource.Fill "800x418").Permalink }}
|
||||||
|
{{ else if hasPrefix .Params.image "unsplash:" }}
|
||||||
|
{{ $unsplash_id := replace .Params.image "unsplash:" "" }}
|
||||||
|
{{ $query := querify "client_id" (getenv "UNSPLASH_ACCESS_KEY") }}
|
||||||
|
{{ $unsplash_data := (getJSON "https://api.unsplash.com/photos/" $unsplash_id "?" $query )}}
|
||||||
|
{{ .Scratch.Set "image" $unsplash_data.urls.small }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue