vhugo / hugallery

A command line script to generate static photos gallery with PhotoSwipe for Hugo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hugallery Build Status: Linux

A command line script to generate static photo albums with PhotoSwipe for Hugo sites.

Table of Contents

Getting started

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.

alt My album gallery

Install

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

Usage

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/

Setting up the album and photos

Hugallery uses a couple of configuration files to create the album, those files are album.json and photos.csv.

album.json

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.

photos.csv

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 album
  • order: position the photos is going to be displayed
  • title: 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

After set up

Once you have update the configuration files, just run the script as shown on usage section.

Hugo themes and album layouts

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.

License

Licensed under the MIT License. See the LICENSE file for more details.

About

A command line script to generate static photos gallery with PhotoSwipe for Hugo

License:MIT License


Languages

Language:Python 100.0%