This was a tough nut to crack. I’m totally new to Go Html Templates and Go itself, and I’ve never really used anything outside of Jekyll. It took me a minute, but I wound up coming up with this:

  1 2 3 4 5 6 7 8 9 10 11 12 13  {{ $image := (resources.Get .Destination) }} {{ with$image }} {{ if eq $image.MediaType.SubType "svg" }} {{ else }} {{$resize := .Fill "200x165 webp q80" }} {{ end }} {{ end }} 

Apparently I have a *.svg file on my blog somewhere, because that was a thing I had to catch right away for this to work. So I had to move all my images out of static and into assets for it to work, first of all. Then I had to figure out how to query a parent context, so I could fill in Text and Title with the images. That’s what the $ is in $.Text. It’s the parent context outside of \$image.

So this generates a 200x165px webp thumbnail for every image and displays that, then allows fancybox to handle full size images along with gallery features and such. It’s really cool. This is better than the theme I’m using’s handling with javascript just enclosing images with a scaled version of the full image. Blech. I hate that half-ass handling. I prefer mine. It’s more robust and makes it so the blogger using this thing can be lazier.

I’m probably still going to tweak the settings though. But yeah, this was cool to get done, but man it was hard as fuck to get from Point A -> Point B.