technonaturalist

image link to hive image link to ko-fi

small quality of life hugo scripts

posted on: Wednesday, 25 February 2026 @ 7:54pm in
tagged

Finally got around to writing a couple of bash scripts to chain the image modifying and deployment stuff together so I can do all of that with one command instead of 2-3. Named without extensions to make my life easier and located in /.local/bin/ because it was already on the path and seemed like a good idea at the time.

blogify (usage: blogify image01 image02 etc or blogify *.ext)

#!/bin/bash

# "apply" orientation flags by actually rotating the image, resize to 1000px on the longest side with a quality of 90 to everything matching whatever was entered
mogrify -auto-orient -resize 1000x1000 -quality 90 $@

# remove all exif data and don't make a backup (if you want backups remove -overwrite_original, alternately make sure you're working on a copy)
exiftool -all= -overwrite_original $@

I’m pretty sure I tested it with the wildcard but am currently second-guessing myself and will find out the hard way when I next need to do it

deploy

#!/bin/bash

# build site after cleaning caches and removing everything in the build directory (to make sure nothing gets uploaded that shouldn't be) and tell me everything that's going on
hugo --gc --cleanDestinationDir --logLevel info

# I use pagefind for site search, this rebuilds its index to include the newest entry
npx -y pagefind --site public

# sync everything in the public directory to the remote server comparing only size otherwise it reuploads everything all the time as the modtime will always change thanks to --cleanDestinationDir and show me what's going on
rclone sync --progress --size-only public/ remote://path/to/publicdir/