1
Fork 0

Use smaller images for post headers

1080 wide should be ample, and the file size reduces massively
This commit is contained in:
Jake Howard 2021-12-27 10:50:35 +00:00
parent 5d56ca8ad2
commit 8644beba1a
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -7,7 +7,7 @@
{{ $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 }}
{{ .Scratch.Set "image" $unsplash_data.urls.regular }}
{{ end }}
<img class="mb-3 header-image" src='{{ .Scratch.Get "image" }}' alt="" />