Hugo Gallery Theme
A very simple and opinionated photo gallery theme for Hugo.
Features
- Responsive design
- Dark theme
- Private albums
- Automatic (or manual) selection of feature images
- Justified album views with Flickr's Justified Layout
- Lightbox with PhotoSwipe
- SEO with Open Graph tags
Installation
This theme is built with Tailwind CSS and requires Hugo >= 0.113, Node.js and NPM.
As a Hugo Module
Requires the Go binary installed.
$ hugo mod init github.com/<your_user>/<your_project>
Then add the theme to your hugo.toml
:
[module]
[[module.imports]]
path = "github.com/nicokaiser/hugo-theme-gallery/v2"
Install required packages:
$ hugo mod npm pack
$ npm install
As Git Submodule
$ git submodule add --depth=1 https://github.com/nicokaiser/hugo-theme-gallery.git themes/gallery
$ hugo mod npm pack
$ npm install
Usage
Page bundles which contain at least one image are listed as album or gallery:
content/
βββ _index.md
βββ about.md <-- not listed in album list
βββ animals/
β βββ _index.md
β βββ cats/
β | βββ index.md
β | βββ cat1.jpg
β | βββ feature.jpg <-- album thumbnail
β βββ dogs/
β | βββ index.md
β | βββ dog1.jpg <-- album thumbnail
β | βββ dog2.jpg
β βββ feature.jpg
βββ bridge.jpg <-- site thumbnail (OpenGraph, etc.)
βββ nature/
βββ index.md <-- contains `featured_image: images/tree.jpg`
βββ images/
| βββ tree.jpg <-- album thumbnail
βββ nature1.jpg
βββ nature2.jpg
/about.md
is not a Page Bundle and does not have image resources. It is not displayed in the album list./nature
is a Leaf Bundle (hasindex.md
and no children) => displayed as gallery (single
layout)./animals
is a Branch Bundle (has_index.md
and has children) => displayed as album list (list
layout).- The image resource with
*feature*
in its name or the first image found is used as thumbnail image for album lists. - Albums without an image are not shown.
Front matter
title
-- title of the album, shown in the album list and on the album page.date
-- album date, used for sorting (newest first).description
-- description shown on the album page.featured_image
-- name of the image file used for the album thumbnail. If not set, the first image which containsfeature
in its filename is used, otherwise the first image in the album.weight
-- can be used to adjust sort order.private
-- if set totrue
, this album is not shown in the album overview and is excluded from RSS feeds.featured
-- if set totrue
, this album is listed on the homepage (even if private).sort_by
-- property used for sorting images in an album. Default isName
(filename), but can also beExif.Date
(only works if all images have EXIF tags).sort_order
-- sort order. Default isasc
.
Customization
The theme is very opinionated but kept simple to you can create a customized version. CSS is generated with Tailwind, PostCSS and Hugo Pipes, so you can use additional Tailwind utility classes in your custom templates.
Custom CSS can be used in assets/css/custom.css
(see the example in exampleSite
).