Skip to content
matzePublic

About

A static photo gallery generator 📷

Topics

Resources

Stars

25 stars

Watchers

2 watching

Forks

Latest commit

 

History

158 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📷 splat

Rust

splat is a command line application to generate static photo galleries from a source directory of image files. It is a spiritual cousin of sigal but written in Rust.

Example output

DEMO OUTPUT

Features

  • Generates static galleries for no-nonsense hosting.
  • Easy installation and simple usage.
  • Clean and beautiful builtin theme with no asset build step.
  • Responsive JPEG thumbnails with optional AVIF variants.
  • EXIF captions and capture-date ordering.
  • Self-hosted display font and social preview metadata.

Installation

For 64-bit Linux systems you can install pre-built binaries from the releases. For other systems, building and installing from source can be done via

cargo install --path .

Usage

splat is a command line application and besides a source directory of image files it requires a splat.toml configuration file and a theme file containing an HTML template as well as optional assets and descriptions in index.md files.

To create an example configuration run splat new and edit splat.toml to your liking, especially adapt the input and output paths. output will be created if it does not exist. Then run splat build to generate the static output.

A minimal configuration looks like this:

input = "input"
output = "build"

[theme]
path = "theme"

[thumbnail]
width = 450
height = 300
widths = [450, 900, 1350]
avif = true

[site]
title = "My photo gallery"
description = "A short description for search engines and link previews."
url = "https://example.com"
lang = "en"

widths controls the responsive thumbnail variants. avif additionally writes AVIF thumbnails and lets browsers choose them. The optional [site] table sets the page language, title suffix, metadata description, and absolute URL used for canonical and Open Graph tags.

The theme is plain HTML and CSS. splat new writes the template, stylesheet, favicon, and self-hosted fonts into theme/, so the generated gallery builds without an extra asset toolchain. Customize theme/static/css/app.css to change its appearance.

You can adjust the chosen collection thumbnail and title (which defaults to the directory name) as well as add a description by adding an index.md file. The first rows matching Title: or Thumbnail: will override the defaults, anything else will be used as a description. Here is an example:

Title: Sunny vacation
Thumbnail: beach.jpg

Vacation was _just_ perfect!

Photos are ordered by EXIF capture date, newest first, with filename order as a fallback. An EXIF ImageDescription is used for the lightbox caption and image alt text; otherwise the filename is humanized.

Templates

Templates must be written in tera syntax. The following hierarchy of variables is available:

  • collection
    • title of this collection
    • description of this collection
    • breadcrumbs
      • path to the corresponding page
      • title of the corresponding page
    • children of sub-collections
      • path to the collection
      • title of the collection
      • thumbnail of the collection
      • srcset and avif_srcset candidates
    • images for this collection
      • path to the image
      • width and height of the image
      • thumbnail of the image
      • srcset and avif_srcset candidates
      • alt, caption, and date from metadata
  • site
    • title, description, url, and lang
  • page_title, canonical, and social_image
  • theme_url

License

MIT

About

A static photo gallery generator 📷

Topics

Resources

Stars

25 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages