mpercivalxyz

this website!
Log | Files | Refs

commit d8aac1a01c23f48d09483e6c324a0d43cc4d7b5e
parent 1f1a2fb43bff7f9e5e36627165d2365e3c1f7ad4
Author: mpizzzle <m@michaelpercival.xyz>
Date:   Sat, 27 Aug 2022 12:44:12 +0100

updating gallery to generate smaller static images

Diffstat:
Mconfig.toml | 8++++++++
Mlayouts/shortcodes/gallery.html | 13+++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/config.toml b/config.toml @@ -1,3 +1,11 @@ baseURL = 'https://michaelpercival.xyz' languageCode = 'en-gb' title = "Michael Percival's Home Page" + +[[module.mounts]] + source = 'static' + target = 'static' + +[[module.mounts]] + source = 'assets/wallpapers' + target = 'static/wallpapers' diff --git a/layouts/shortcodes/gallery.html b/layouts/shortcodes/gallery.html @@ -1,5 +1,10 @@ -{{ range os.ReadDir "static/wallpapers" }} - <a href="/wallpapers/{{ .Name }}"> - <img src="/wallpapers/{{ .Name }}" width="192" height="108"> - </a> +{{ range os.ReadDir "assets/wallpapers" }} +{{ $name := .Name }} +{{ $image := resources.Get (printf "wallpapers/%s" $name) }} +{{ $image := $image.Resize "192x108" }} +{{ with $image }} +<a href="{{ $name }}"> + <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}"> +</a> +{{ end }} {{ end }}