A command line script to generate static photo albums with PhotoSwipe for Hugo sites.
Make sure you have a folder for your album with all photos you want to post inside it. If you want to see the results from this tool, check out my site. Here is a screenshots.
In order for Hugallery to work with photos, you will need to install ImageMagick. Then just run the following command to easily install.
pip install git+https://github.com/vhugo/hugallery.git
First time you run the command for a new album folder, it will create the configuration files you need, if you already have it configured, then it should generate the photo album inside Hugo project, if you don't know how to configure, check the next section.
hugallery /my-album-folder/
Hugallery uses a couple of configuration files to create the album,
those files are album.json
and photos.csv
.
Your album.json
should look something like this:
{
"album_name": "Your Album Name",
"hugo_location": "/your/hugo/site/directory/",
"max_size": 900,
"max_thumbnail_size": 164
}
Make sure hugo_location has the location of your Hugo site project.
You can use any spreadsheet editor that supports CSV files to edit
photos.csv
, when you first open it should look something like this:
cover | order | title | description | filename |
---|---|---|---|---|
True | 0 | photo01.jpg | ||
1 | photo02.jpg | |||
2 | photo03.jpg | |||
... | ... | |||
20 | photo20.jpg |
cover
: just type "True" if you want the photo as cover of your albumorder
: position the photos is going to be displayedtitle
: title for the photo (when the file is created this is shown as empty)description
: also known as photo caption (when the file is created this is shown as empty)filename
: this information is used by the script so please do not change it
Once you have update the configuration files, just run the script as shown on usage section.
Hugallery will add two files, gallery/single.html
and
section/gallery.html
, in Hugo project's layouts
folder. Change those
files to adapt the gallery to your current theme. When changing these
files, make sure you include the PhotoSwipe JS and CSS files in the theme's
header and/or footer.
Licensed under the MIT License. See the LICENSE file for more details.