A Gum powered interactive Bash script to create Hugo photo posts in a section called film
. By default it is targeted for Film photography posts, but this script can be adapted for any kind of a post-type where the user wants to be prompted for specific tags that are defined in plain-text files. This repo is meant to be a standalone demonstration, you'll want to customize your seleection options from the defaults.
Higher quality webm demo file is on my website if listening to the audio of a mechanical keyboard clacking away is your thing!
I didn't have a good process to add film photos to my Hugo static site with consistent tags to serve as metadata for camera, film, developer, format, etc. so I cobbled together a small Bash script to collect some input and create a folder as a Hugo page bundle
but it was a very manual process still and the tag template immediately became tedious to maintain.
I discovered Gum and decided to play with it to see if it would improve my post creation experience and it has been pretty good during my brief testing.
- Bash
- Gum
- Hugo binary is not required to be installed locally
Install Gum using instructions found in the Gum repo.
Recommended install location is in the Hugo site root folder as git submodule
. You could also copy just the filmPoster.sh
file and create your own text files so any future updates to this repo doesn't upset your customizations.
git submodule add https://github.com/shombando/filmPoster.git
git submodule init
-
Path of the output folder that will be created (a Hugo Page Bundle), from where this script/repo exists. Change the last part of the path from
film
to whatever you want to call your Hugo section. Note: this script assumes that the section (folder) exists. If it doesn't then just drop a file called_index.md
in that section (folder) and it will create a list of posts. If you want the same layout as the demo gif, put these files here into the/layouts/film
folder.OUTPUT_DIR="../content/film"
-
Default starting directory for locating Photos
PHOTOS_DIR=~/Pictures
⚠️ Warning
The options that show up in the prompts are defined in the *.txt files. Because this repo is meant to be a standalone demo the configuration is checked in but ideally those options would be customized by you. Just know if that you use this repo "in production" (which is absolutely not recommended) and theny you do customize and run an update on this submodule you will see conflicts. They're populated with my personal choice and I plan on using this repo to keep my personal configuration so it'll change and grow over time.
Update all the text files with the information that is relevant for you.
All files will accept a new entry per line. These will be generated as Hugo tags so they should not contain spaces.
- cameras.txt
- developers.txt
- filmstocks.txt
- format.txt
- labs.txt
Call the script ./filmPoster.sh
and use arrow navigation keys or type in the filter list for fuzzy matching. Gum also support vim keys for navigation including in the file picker (h
for up one level and l
for drilling down).