Revela

Sorting

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


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 Field used to order photos that have no value for images.field filename

The same image sort applies to folder galleries, filter galleries and [[gallery]] blocks without their own | sort clause.

Photos Without a Value

Photos that have no value for the sort field (for example no EXIF date, or no rating) always come last, whether you sort asc or desc. Among themselves they are ordered by the fallback field in the same direction, and the file name breaks any remaining tie.


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
rating XMP star rating (Capture One, Lightroom); unrated photos last
title Photo title (XMP, else Windows title)
exif.raw.Copyright Copyright field
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 = "rating:desc"
+++

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

Photos in chronological order (oldest first).
+++
title = "Latest Work"
sort = "dateTaken:desc"
+++

Most recent photos 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

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:


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 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. Photos without a value for the sort field come last, ordered by the fallback field
  5. Fallback is always from global config (not overridable per gallery)
  6. Final tie-breaker is always filename (for stable sorting)