1
0
Fork 0
mirror of https://github.com/GuerillaStudio/now-playing synced 2024-11-09 14:31:51 +00:00

Serve covers as webp

This commit is contained in:
Tixie 2022-02-10 23:26:56 +01:00
parent c698ed7faf
commit bf33dc92ac
2 changed files with 6 additions and 6 deletions

View file

@ -29,9 +29,9 @@
<div class="album-layout"> <div class="album-layout">
<picture class="album-cover"> <picture class="album-cover">
{{ $original := resources.Get .Params.cover }} {{ $original := resources.Get .Params.cover }}
{{ $coverSmall := $original.Resize "x250" }} {{ $coverSmall := $original.Resize "x250 webp" }}
{{ $coverMedium := $original.Resize "x500" }} {{ $coverMedium := $original.Resize "x500 webp" }}
{{ $coverBig := $original.Resize "x1000" }} {{ $coverBig := $original.Resize "x1000 webp" }}
{{ $placeholder := $original.Resize "x1" }} {{ $placeholder := $original.Resize "x1" }}
<source srcset="{{ $coverSmall.Permalink }} 1x, {{ $coverMedium.Permalink }} 2x" media="(max-width: 427px)"> <source srcset="{{ $coverSmall.Permalink }} 1x, {{ $coverMedium.Permalink }} 2x" media="(max-width: 427px)">
<source srcset="{{ $coverMedium.Permalink }} 1x, {{ $coverBig.Permalink }} 2x" media="(max-width: 480px)"> <source srcset="{{ $coverMedium.Permalink }} 1x, {{ $coverBig.Permalink }} 2x" media="(max-width: 480px)">

View file

@ -36,9 +36,9 @@
{{ range sort $paginator.Pages "Date" "desc" }} {{ range sort $paginator.Pages "Date" "desc" }}
{{ $original := resources.Get .Params.cover }} {{ $original := resources.Get .Params.cover }}
{{ $originalPermalink := $original.Permalink }} {{ $originalPermalink := $original.Permalink }}
{{ $cover := $original.Resize "x320" }} {{ $cover := $original.Resize "x320 webp" }}
{{ $cover2x := $original.Resize "x640" }} {{ $cover2x := $original.Resize "x640 webp" }}
{{ $placeholder := $cover.Resize "x1" }} {{ $placeholder := $cover.Resize "x1 png" }}
<div class="catalog-item"> <div class="catalog-item">
<a class="catalog-item__content" href="{{ .Permalink }}"> <a class="catalog-item__content" href="{{ .Permalink }}">
<h2 class="catalog-item__album">{{ .Title }}</h2> <h2 class="catalog-item__album">{{ .Title }}</h2>