Skip to main content

Module generate

Module generate 

Source
Expand description

HTML site generation.

Stage 3 of the Simple Gal build pipeline. Takes the processed manifest and generates the final static HTML site.

§Generated Pages

  • Index page (/index.html): Gallery list showing top-level album/group cards
  • Gallery-list pages (/{group}/index.html): Gallery list for a container directory, showing cards for each child album or sub-group
  • Album pages (/{album}/index.html): Thumbnail grid for an album
  • Image pages (/{album}/{n}-{slug}.html): Full-screen image viewer with navigation
  • Content pages (/{slug}.html): Markdown pages (e.g. about, contact)

§Features

  • Responsive images: Uses AVIF srcset for responsive images
  • Collapsible navigation: Details/summary for mobile-friendly nav
  • Keyboard navigation: Arrow keys and swipe gestures for image browsing
  • View transitions: Smooth page-to-page animations (where supported)
  • Configurable colors: CSS custom properties generated from config.toml

§Output Structure

dist/
├── index.html                 # Gallery list (top-level cards)
├── about.html                 # Content page (from 040-about.md)
├── Landscapes/
│   ├── index.html             # Album page (thumbnail grid)
│   ├── 1-dawn.html            # Image viewer pages
│   ├── 2-sunset.html
│   ├── 001-dawn-800.avif      # Processed images (copied)
│   └── ...
└── Travel/
    ├── index.html             # Gallery-list page (child album cards)
    ├── Japan/
    │   ├── index.html         # Album page
    │   └── ...
    └── Italy/
        └── ...

§CSS and JavaScript

Static assets are embedded at compile time:

  • static/style.css: Base styles (colors injected from config)
  • static/nav.js: Keyboard and touch navigation

§Custom Snippets

Users can inject custom content by placing convention files in assets/:

  • custom.css: Linked after the main <style> block for CSS overrides
  • head.html: Raw HTML injected at the end of <head> (analytics, meta tags)
  • body-end.html: Raw HTML injected before </body> (tracking scripts, widgets)

§HTML Generation

Uses maud for compile-time HTML templating. Templates are type-safe Rust code with automatic XSS escaping.

Structs§

Album
GeneratedVariant
Image
Manifest
Processed manifest from stage 2

Enums§

GenerateError

Functions§

generate
render_nav
Renders the navigation menu (hamburger style, slides from right).