diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4cf936d..0d6114e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: [push, pull_request] env: FLICKR_API_KEY: ${{ secrets.FLICKR_API_KEY }} FLICKR_USER_ID: ${{ secrets.FLICKR_USER_ID }} + UNSPLASH_API_KEY: ${{ secrets.UNSPLASH_API_KEY }} jobs: docker: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 18f2ecb..4e92a24 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -8,6 +8,7 @@ on: env: FLICKR_API_KEY: ${{ secrets.FLICKR_API_KEY }} FLICKR_USER_ID: ${{ secrets.FLICKR_USER_ID }} + UNSPLASH_API_KEY: ${{ secrets.UNSPLASH_API_KEY }} jobs: build: diff --git a/content/posts/kimsufi-vanilla-arch-install/index.md b/content/posts/kimsufi-vanilla-arch-install/index.md index de83399..b640a1e 100644 --- a/content/posts/kimsufi-vanilla-arch-install/index.md +++ b/content/posts/kimsufi-vanilla-arch-install/index.md @@ -2,6 +2,7 @@ title: Installing Arch from scratch on Kimsufi date: 2020-08-29 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. diff --git a/layouts/partials/content.html b/layouts/partials/content.html index be88765..1da959d 100644 --- a/layouts/partials/content.html +++ b/layouts/partials/content.html @@ -3,6 +3,11 @@ {{ if hasPrefix .Params.image "resource:" }} {{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }} {{ .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 }}
diff --git a/layouts/partials/list_item.html b/layouts/partials/list_item.html index 9f7c89d..f33364c 100644 --- a/layouts/partials/list_item.html +++ b/layouts/partials/list_item.html @@ -6,6 +6,11 @@ {{ if hasPrefix .Params.image "resource:" }} {{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }} {{ .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 }}
diff --git a/layouts/partials/metadata.html b/layouts/partials/metadata.html index cc53bb7..e1b357e 100644 --- a/layouts/partials/metadata.html +++ b/layouts/partials/metadata.html @@ -3,6 +3,11 @@ {{ if hasPrefix .Params.image "resource:" }} {{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }} {{ .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 }}