Skip to main content
Version: 2.7.1

Gallery block syntax

All options are written inside an obs-gallery fenced code block as YAML.

The plugin utilizes a structured nested configuration schema (v2) consisting of a sources array and a view object.

[!TIP] You don't have to write YAML by hand. Use the Gallery View: Insert gallery command from the command palette to open an interactive builder that generates the block for you. See Gallery Builder for details.

Additionally, Gallery View provides YAML autocomplete inside obs-gallery blocks — press your autocomplete key while typing a field value to get context-aware suggestions.

Structure​

sources:
- type: local
path: Images
view:
type: thumbnail

sources​

Required (unless using legacy syntax). The sources key takes a list of objects. Each object represents an image source. You can define multiple sources in a single gallery block, and the plugin will load images from all of them.

See the Sources section for details on configuring specific source types (local, external, immich-share, immich, nextcloud-share, nextcloud).

view​

Optional. Defaults to thumbnail. The view key sets how the gallery is laid out. It can be just the view name, or an object with the name under type plus options:

view: masonry # short form
view: # long form, with options
type: masonry
pagination: true
itemsPerPage: 24
KeyValuesDefaultDescription
typethumbnail, carousel, masonry, justified, embedthumbnailThe layout. The older name grid is still accepted and renders as masonry.
paginationtrue / falseThe Enable pagination by default setting (off)Show a fixed number of images per page with Prev/Next buttons, instead of one long scroll. All views except carousel.
itemsPerPagewhole number, 1–10000The Images per page setting (24)Images per page when pagination is on. All views except carousel.
paginationPositiontop / bottomThe Page controls position setting (bottom)Whether the Prev/Next controls sit above or below the gallery. All views except carousel.
captionstrue / falseThe Show captions setting (on)true: captions under each image. false: captions only on hover. All views.
frametrue / falseThe Show gallery frame setting (on)false removes the box around the gallery (border, shadow, background and padding), so the images sit directly in the note. Thumbnail tiles keep their card look. All views except embed, which never has a frame.
rowHeightnumber of pixels, 40–1000220Target row height. justified only.
columnWidthnumber of pixels, 60–1000220Minimum column width; the number of columns follows the note's width. masonry only.
gapnumber of pixels, 0–648 (masonry), 4 (justified)Space between images. masonry and justified.
heightnumber of pixels, 120–1500420Height of the stage. carousel only.

These options override the plugin settings, and any CSS snippet sizes, for this gallery only:

view:
type: justified
rowHeight: 160
gap: 2
captions: false

A value of the wrong type or out of range (for example rowHeight: big) stops the gallery with an error. An unknown option, or one that doesn't apply to the chosen view (for example rowHeight on a masonry gallery), is ignored and noted in a line under the gallery, so typos such as itemPerPage don't go unnoticed. Turning off Error messages in settings hides these notes too.

See the Views section for each layout, and the Image viewer for what happens when you click an image.


Backward Compatibility​

[!NOTE] For convenience and backward compatibility, the plugin transparently translates legacy v1 root-level keys into the new structured format. However, the v2 schema documented above is the preferred format going forward.

Legacy keySame as
path: Imagesa local source with that path
recursive: falserecursive on that local source (default true)
urls: [...]an external source with those urls
path: Images/Screenshots
recursive: false
view: masonry