Revela

Sorting

Revela supports flexible sorting of galleries and images. You can configure:

  • Gallery order in navigation (ascending/descending)
  • Image order within galleries (by any field including EXIF data)
  • Per-gallery overrides via front matter

Global Configuration

Configure sorting in project.json:

{
  "generate": {
    "sorting": {
      "galleries": "asc",
      "images": {
        "field": "dateTaken",
        "direction": "desc",
        "fallback": "filename"
      }
    }
  }
}
Property Description Default
galleries Gallery sort direction: asc or desc asc
images.field Field to sort images by dateTaken
images.direction Image sort direction: asc or desc desc
images.fallback Fallback field when primary is null filename

Available Sort Fields

Field Description
filename File name (alphabetical)
dateTaken EXIF capture date
exif.focalLength Focal length in mm
exif.fNumber Aperture (f-number)
exif.exposureTime Shutter speed
exif.iso ISO sensitivity
exif.make Camera manufacturer
exif.model Camera model
exif.lensModel Lens model
exif.raw.Rating Star rating (1-5)
exif.raw.{FieldName} Any EXIF field from Raw dictionary

Override the global sort settings for individual galleries using front matter in _index.revela:

Format:

sort = "field"           # Use field, direction from global config
sort = "field:asc"       # Use field with ascending order
sort = "field:desc"      # Use field with descending order

Examples:

+++
title = "Lens Comparison"
sort = "exif.focalLength:asc"
+++

Compare shots from wide-angle to telephoto.
+++
title = "Best Shots"
sort = "exif.raw.Rating:desc"
+++

My highest rated photos.
+++
title = "Timeline"
sort = "dateTaken:asc"
+++

Photos in chronological order (oldest first).

Control gallery order in navigation by adding number prefixes to folder names:

source/
├── 01 Weddings/           # Appears first
│   └── *.jpg
├── 02 Portraits/          # Appears second
│   └── *.jpg
├── 03 Landscapes/         # Appears third
│   └── *.jpg
└── 99 Archive/            # Appears last
    └── *.jpg

How It Works

  • Prefix format: 1-2 digit number followed by a space (e.g., 01 , 2 , 99 )
  • Display name: Number prefix is automatically removed
    • 01 Weddings → displayed as "Weddings"
    • 99 Archive → displayed as "Archive"
  • URL slug: Number prefix is stripped from URLs
    • 01 Weddings/weddings/
  • Natural sorting: Uses natural order (1, 2, 10 instead of 1, 10, 2)

Year Prefixes Are Preserved

Four-digit year prefixes are NOT stripped (they're meaningful content):

source/
├── 2024 Summer/           # Displayed as "2024 Summer"
├── 2023 Fall/             # Displayed as "2023 Fall"
└── 2022 Winter/           # Displayed as "2022 Winter"

Combining with galleries Setting

The galleries setting controls sort direction:

{
  "generate": {
    "sorting": {
      "galleries": "desc"
    }
  }
}

With desc:

  • 01 Weddings99 Archive becomes 99 Archive01 Weddings
  • Year folders: 2024 → 2023 → 2022

CLI Configuration

Configure sorting interactively or via command line:

# Interactive wizard
revela config sorting

# Set image sort field
revela config sorting --field dateTaken --direction desc

# Sort by rating
revela config sorting --field exif.raw.Rating --direction desc

# Sort by focal length
revela config sorting --field exif.focalLength --direction asc

# Change gallery order
revela config sorting --galleries desc

Logic Flow

  1. No front matter sort → Use global config (generate.sorting.images)
  2. sort = "field" → Override field, keep global direction
  3. sort = "field:direction" → Override both field and direction
  4. Fallback is always from global config (not overridable per gallery)
  5. Final tie-breaker is always filename (for stable sorting)