Problem is that you manually have to put a lot of meta stuff into your Markdown Pages. So I made a small quick’n’dirty Bash script that does those things.
I’m running this under OS X & ITerm2, but Linux should be fine, too.
- ImageMagick for Image conversion:
brew install imagemagickLinux users might have this already installed.
- (optional) imgcat to show Images while writing a caption (ITerm2 Users only)
- Bash (ok, should be there :) )
First of all, follow the steps in the Blog Post above, if you haven’t done that yet.
Now, put this Script into your Hugo’s Project root.
Edit the header of that script:
#!/bin/bash # Bjoern Pohl, License: CC0 ###setup #Imagesize. Currently only Landscape imagesize="1280x960" #Thumbnail size. 100x100 is good. thumbnailsize="100x100" #incoming pictures folder relative to script location's folder. inc_folder="incoming_pictures" ###end of setup
Add an “incoming_pictures” Folder to the root of your Hugo Git Project ( you’re using Git, aren’t you)? where you simply throw Pictures you want to use for your Blog Post.
Mine is called “incoming_pictures”. Place a .gitkeep inside, add that folder to .gitignore and throw a
git add -f <folder>/.gitkeep to put that folder under Version control while ommiting all those pictures coming in.
The Script will pick those pictures up from there and will put it under
- Put some Images into you incoming folder ( Script currently just looks for .jpg/.JPG/)
- Run the Script: ./to_gallery. No Options required
- it will ask you for a Gallery Name
- it will ask you for Captions for each Image. If imgcat is installed, it will show a small thumbnail.
- finally, it will output all that meta stuff you need to show the Galley in your Hugo Post.
Perhaps it is possible to mix that with Hugo’s Archetypes, haven’t figured that out…
Does it work? Yes: