New Grid Modes: Masonry, Square, and Variable Columns
Tenrankai’s gallery grid just got a lot more flexible. You can now choose between two layout modes and control exactly how many columns your galleries display.
What’s New
Two grid modes:
- Masonry (default) – the familiar variable-height layout that preserves each image’s natural aspect ratio.
- Square – a uniform grid of square cells where images are fitted inside without cropping, with themed backgrounds filling the remaining space.
Variable columns with responsive breakpoints:
The grid now scales from 1 to 5 columns based on the viewer’s screen width, capped by a configurable max_columns setting. The default of 2 preserves the original layout, but you can open it up for wider displays.
Configuration
Add two lines to your gallery config:
# config.d/sites/default/galleries/main.toml
grid_mode = "square" # or "masonry" (default)
max_columns = 4 # 1-5, default: 2
Folder-Level Overrides
Different folders can use different grid settings. Add grid_mode and max_columns to your _folder.md frontmatter:
+++
title = "Product Shots"
grid_mode = "square"
max_columns = 4
+++
Settings cascade: folder overrides gallery, gallery overrides defaults.
Admin UI Support
Both settings are configurable through the Admin UI at /_admin/ – per gallery and per folder, no config files required.
See the Gallery Setup documentation for full details.