In short
A landscape photo book showing one day in the mountains in six pictures. It shows how to fill whole pages with photos to the edge, and stretch one picture across two facing pages.
What you'll build
Sierra, a landscape photobook on a 280 × 210 mm page: one day in a granite range in six plates, from first light to the morning after the first snow. Each plate fills its page to the trim and carries only a small numeral and the hour in its lower left corner; the first also carries the title, SIERRA in 72-pt Syne, reversed out of the dawn sky. The storm runs across the gutter of pages 4 and 5 as one picture. Three short texts, set in a 100 mm column near the spine, face the plates that follow them. The storm’s text ends on a smaller dusk plate that floats under it, with its numeral in the caption. The last plate shows the cirque of the second from the same boulder, under snow. The plates are photographs generated with diffusion models; the snow plate was made as an edit of the noon plate, so the two views match.
This recipe answers
- How do I give every chapter its own photo, colour or opener variant?
- How do I insert deliberate blank pages, or start a section on a fresh spread?
- How do I hide running heads on openers and blank pages, or paint a blank verso in the part colour?
- How do I set unnumbered artwork: ornaments, vignettes, logos?
The short answer
// '{attr.art}' is filled in per heading, so a plain plate names its picture on its line:
// # Noon {style="lamina" art="mediodia" …}. Only the cover and the last plate draw extras.
const PLATES = [ // the style id, its picture, the ink of its caption, anything extra it draws
{ id: 'alba', art: 'alba', extra: (colour) => cover(colour) }, // an arrow: cover() is below
{ id: 'lamina', art: '{attr.art}' }, // any plate on a page of its own
{ id: 'pliego', art: '{attr.art}', half: 'verso' }, // one picture across a spread:
{ id: 'pliego-recto', art: '{attr.art}', half: 'recto' }, // the left half, then the right
{ id: 'nieve', art: 'nieve', ink: 'ink', extra: (colour) => colophon(colour) },
];
const plate = ({ id, art, half, ink = 'white', extra = () => [] }) => ({
id, span: 'page', // an opener: a span heading always starts a page of its own
// The left half opens on an even page, a verso, so the right half faces it across the
// gutter (gotcha: parity-page1-recto).
...(half === 'verso' && { breakBefore: { enabled: true, parity: 'even' } }),
// The picture is as deep as the page, more than the column holds: the plate claims the
// whole page, and what follows starts on the next one.
advancedDesign: { enabled: true, slot: { elements: [
{ kind: 'image', id: 'picture', resourceId: art, // the recto half is the same picture,
placement: at('page', 'top-left', half === 'recto' ? -PAGE.width : 0, 0, // moved left
{ width: mm(half ? 2 * PAGE.width : PAGE.width), height: mm(PAGE.height) }) },
...(half === 'recto' ? [] : caption(col(ink))), ...extra(col(ink)),
] } },
});
The plates' heading styles, generated from a list
Ingredients
- Features
- Pictures in page designsHeading stylesDesigned openersAnchoring design elementsSection geometryHeading attributesChapters that open on a rectoHeads by page roleCitations that place figuresCustom resource typesCaption styleCovers, title pages and colophonsPaper colourMirrored marginsText, rules and boxes in page designsHyphenation and document languageSemantic colour paletteFigures and tables as resourcesPages on a canvas
- Type
- Andada Pro, Syne, Syne Mono (SIL OFL 1.1)
- Assets
alba-1600.jpgatardecer-2000.jpgmediodia-1600.jpgnieve-1600.jpgnoche-1600.jpgtormenta-2400.jpg- Plate I, dawn: ridges fading into a peach haze under a dark blue sky (Generated With Diffusion Models, original)
- Plate II, noon: a granite cirque and its lake (Generated With Diffusion Models, original)
- Plate III, storm: rain, lightning and a break of sun across a spread (Generated With Diffusion Models, original)
- Plate IV, dusk: the crest lit orange under a violet sky (Generated With Diffusion Models, original)
- Plate V, night: stars over the ridges and a lit refuge (Generated With Diffusion Models, original)
- Plate VI, snow: the cirque of plate II the morning after (Generated With Diffusion Models, original)
Method
#1 · A heading style for each plate, built from a list
The code is the short answer above. plate() builds a heading style from each row of PLATES, and the Markdown sets the order of the essay, one line per plate: # Night {style="lamina" art="noche" n="V" hora="22:10"}. The image element's resourceId is '{attr.art}', a placeholder like a text's, so every plain plate shares the lamina style and names its picture on its heading line; only the cover and the last plate, which draw extras, keep a style of their own (image elements). span: 'page' starts every plate on a page of its own. The picture is 210 mm deep, the height of the page, and a design reserves down to the foot of its pictures. That is more than the 158 mm column of the text pages, so the plate claims the whole page and whatever follows it starts on the next one, with no minHeight and no margins of its own.
The spread’s two styles, pliego and pliego-recto, draw the same 560 mm picture, here art="tormenta": the verso half at the page’s left edge, the recto half 280 mm further left, so each page shows its own half and the canvas crops the rest at the trim. parity: 'even' keeps the two halves facing. Without it, taking the noon plate out of the Markdown would put the left half on page 3, a recto, and the right half overleaf on page 4; with it, page 3 stays blank and the storm still fills pages 4 and 5.
#2 · The numeral and the hour come from the heading line
const NUMERAL = { x: 16, y: PAGE.height - 21, size: 13 }; // mm from the top left; size in pt
// A design text's baseline sits 0.8 of its line box below its top: set a smaller label beside
// a larger one this much lower and the two share a baseline.
const dropTo = (big, small, lineHeight = 1.2) => (0.8 * lineHeight * (big - small) * 25.4) / 72;
const caption = (colour) => [
{ kind: 'text', id: 'numeral', content: '{attr.n}', fontFamily: 'Syne', fontWeight: 700,
fontSize: pt(NUMERAL.size), color: colour, align: 'left',
placement: at('page', 'top-left', NUMERAL.x, NUMERAL.y) },
{ kind: 'text', id: 'hour', content: '· {attr.hora}', fontFamily: 'Syne Mono', fontSize: pt(8),
letterSpacing: pt(0.8), color: colour, align: 'left', // the dot: a lone I reads as a bar
placement: at('#numeral', 'right-of', 1.6, dropTo(NUMERAL.size, 8)) },
];
The numeral and the hour are heading attributes, so the content stays in the Markdown and one design serves every plate. The hour hangs right-of the numeral, which aligns their tops. A design text’s baseline sits 0.8 of its line box below the element’s top, and the line box is 1.2 times the type size by default, so dropTo(13, 8) lowers the hour by 0.8 × 1.2 × (13 − 8) pt and puts the 8-pt hour on the 13-pt numeral’s baseline, 193.4 mm from the top of the page. The hour opens with a middle dot, as plate IV’s caption does, because Syne’s I is a plain bar, and alone beside the hour it reads as a rule. The recto half of the storm draws no caption, and the snow plate sets its caption in ink, because its foreground is white.
#3 · A title and a colophon on the plates themselves
const cover = (colour) => [
{ kind: 'text', id: 'title', content: '{title}', fontFamily: 'Syne', fontWeight: 800,
fontSize: pt(72), lineHeight: 1, letterSpacing: pt(6), textTransform: 'uppercase',
color: colour, align: 'left', placement: at('page', 'top-left', 22, 26) },
{ kind: 'text', id: 'subtitle', content: '{subtitle}', fontFamily: 'Syne Mono',
fontSize: pt(10), letterSpacing: pt(2), textTransform: 'uppercase', color: colour,
align: 'left', placement: at('#title', 'below', 1.5, 3) },
];
// The colophon: one element per line, 10.5 pt apart, so the break falls after the licence, and
// the second line on the baseline of the plate's numeral.
const COLOPHON = { y: NUMERAL.y + dropTo(NUMERAL.size, 7.5), leading: (10.5 * 25.4) / 72 };
const colophon = (colour) => ['colofon', 'tipos'].map((key, line) => ({ kind: 'text', id: key,
content: `{attr.${key}}`, fontFamily: 'Syne Mono', fontSize: pt(7.5), letterSpacing: pt(0.2),
color: colour, align: 'right',
placement: at('page', 'top-right', -16, COLOPHON.y - (1 - line) * COLOPHON.leading) }));
The first plate is the cover. {title} and {subtitle} read the frontmatter, and extra in PLATES adds both elements to that plate’s design, in the colour of its caption. The colophon goes on the last plate the same way, in ink on the snow: two 7.5-pt elements, one per line, from the colofon and tipos attributes, flush right, the second on the numeral’s baseline. A single wrapped element would break wherever its width ran out; with one element per line, the break falls after the licence.
#4 · Texts follow their plates without a break
const textOpener = { enabled: true, slot: { elements: [
{ kind: 'text', id: 'hours', content: '{attr.hora}', fontFamily: 'Syne Mono', fontSize: pt(8),
letterSpacing: pt(0.8), color: col('accent'), align: 'left',
placement: at('container', 'top-left', 0, 0) },
{ kind: 'text', id: 'title', content: '{titleText}', fontFamily: 'Syne', fontWeight: 700,
fontSize: pt(28), lineHeight: 1.05, // a multiple of the size
color: col('ink'), align: 'left', overflow: 'wrap',
placement: at('#hours', 'below', 0, 2.5, { width: 'fill' }) },
] } };
// The folio and the book's title under the text block, flush with its left edge, on the
// baseline of the plates' numerals. Not on the plates: a span heading opens their pages, so
// they are opener pages, and 'body' leaves them out.
const foot = (id, content, extra) => ({ kind: 'text', id, content, pages: 'body',
fontFamily: 'Syne Mono', fontSize: pt(7.5), letterSpacing: pt(0.8), color: col('muted'),
align: 'left', ...extra });
const FOOT = NUMERAL.y + dropTo(NUMERAL.size, 7.5) - (PAGE.height - MARGIN.bottom); // from the foot
const footer = { elements: [
foot('folio', '{pageNumber}', { color: col('ink'),
placement: at('container', 'top-left', 0, FOOT) }),
foot('book', '{title}', { textTransform: 'uppercase', placement: at('#folio', 'right-of', 5) }),
] };
The plate before a text fills its page, so the text starts the next page with no break of its own. A page whose first block is a heading with a break is an opener page, and the folio’s pages: 'body' leaves it out. With no break, the text pages keep their folio; the plates, opened by span headings, get none. breakBefore: { enabled: false } switches off the break to a recto that a level-1 heading has by default; with that break, each text’s page would be an opener page, without a folio. FOOT sets the folio on the baseline of the plates’ numerals, 193.4 mm from the top of the page, so a text’s folio and the numeral of the plate facing it sit on one line.
#5 · Declare every plate, cite only the one that floats
// Plate IV is the one plate that floats, so a counter of its type would number it 1. The type
// prints no number (no caption prefix, an empty template) and the caption carries the numeral.
// The text names the plate with :ref's text, since a bare :ref prints 'lámina' and nothing else.
const lamina = { id: 'lamina', name: t({ en: 'Plate', es: 'Lámina' }),
shortLabel: t({ en: 'plate', es: 'lámina' }), numberingTemplate: '',
resetOn: 'never', counterFormat: 'decimal', captionPrefix: '' };
// JPEGs in assets/, cut to the page's shape: 1600 × 1200 px for 280 × 210 mm (145 dpi).
const picture = (id, [w, h], alt, extra = {}) => ({ id, typeId: 'lamina', kind: 'bitmap',
bitmap: { fileId: `${id}-${w}.jpg`, format: 'jpeg', width: w, height: h },
createdAt: 0, updatedAt: 0, altText: t(alt), ...extra });
const resources = [ // the five the heading styles draw, never cited, and plate IV
picture('alba', [1600, 1200], { en: 'Eight ridges fading into a peach dawn haze.',
es: 'Ocho crestas que se pierden en la bruma del alba.' }),
picture('mediodia', [1600, 1200], { en: 'A granite cirque and its lake under a pale noon sky.',
es: 'Un circo de granito y su laguna bajo el cielo pálido del mediodía.' }),
picture('tormenta', [2400, 900], { en: 'A storm over the range: rain on the left, lightning '
+ 'and a break of sun on the right.', es: 'Una tormenta sobre la sierra: lluvia a la '
+ 'izquierda; un rayo y un claro de sol a la derecha.' }),
picture('noche', [1600, 1200], { en: 'Stars over dark ridges and two lit windows at a refuge.',
es: 'Estrellas sobre crestas oscuras y dos ventanas encendidas en un refugio.' }),
picture('nieve', [1600, 1200], { en: 'The cirque the morning after, white with new snow.',
es: 'El circo a la mañana siguiente, blanco de nieve nueva.' }),
// 2000 px, 339 mm at the layout's 150 dpi, which the float fits to the 100 mm measure.
picture('atardecer', [2000, 800], { en: 'A crest lit orange under strips of cloud, violet sky.',
es: 'Una cresta encendida de naranja bajo franjas de nube, en un cielo violeta.' },
{ caption: t({ en: 'IV · Dusk · 19:41', es: 'IV · Atardecer · 19:41' }) }),
];
A design’s image element draws a declared resource, so all six pictures are in resources: JPEGs in the recipe’s assets/, each cut to the shape of the page or spread it fills and declared at its pixel size, which is all the layout reads. loadImage() registers each file before the build. Plate IV is the only one cited with :ref, and so the only one that floats. It takes the first free slot after the citation, on the page of its text, one line under the last paragraph. A numbered type would caption it Plate 1, since it is the only resource of its type that floats. lamina has an empty numberingTemplate and an empty captionPrefix instead, so no Plate. is printed, and the caption itself begins with IV. In the sentence, :ref’s text names the plate, because a bare :ref prints only the word plate.
The whole recipe
// ═══ Postext Cookbook · Nº 068 · Photo essay with full-bleed plates ═══════════════
// https://postext.dev/en/cookbook/photo-essay-full-bleed
// Code: MIT · Text: original (CC BY 4.0) · Plates: diffusion models
// Fonts: Andada Pro, Syne, Syne Mono (SIL OFL 1.1) · Needs postext ≥ 1.42.1
// Sierra, a landscape photobook: one day in a mountain range in six plates, each on a page of
// its own and one across the gutter of a spread, with three short texts between them.
import {
buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'photo-essay-full-bleed';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: the paper between the plates, the ink and one rust for the labels
const palette = {
ink: '#1c1f27', // text: the blue-black of the night plate
paper: '#f3f0ea', // every page's ground: a pale stone, seen only between the plates
accent: '#94462e', // the times over each text: the dusk plate's rust, dark enough for 8 pt
muted: '#5f646d', // the running foot and the caption of the small plate
white: '#fbfaf7', // type set on the plates
};
// col() links a colour to its palette entry; the hex is the value the entry holds.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = Object.entries(palette)
.map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } }));
// #endregion
const PAGE = { width: 280, height: 210 }; // a landscape photobook, in mm
const MARGIN = { top: 28, bottom: 24, inner: 40, outer: 140 }; // text pages: a 100 mm measure
const LEAD = 15; // body leading in pt
const at = (to, edge, x = 0, y = 0, size) => ({ anchor: { to, edge },
offset: { x: mm(x), y: mm(y) }, ...(size && { size }) });
// #region answer: the plates' heading styles, generated from a list
// '{attr.art}' is filled in per heading, so a plain plate names its picture on its line:
// # Noon {style="lamina" art="mediodia" …}. Only the cover and the last plate draw extras.
const PLATES = [ // the style id, its picture, the ink of its caption, anything extra it draws
{ id: 'alba', art: 'alba', extra: (colour) => cover(colour) }, // an arrow: cover() is below
{ id: 'lamina', art: '{attr.art}' }, // any plate on a page of its own
{ id: 'pliego', art: '{attr.art}', half: 'verso' }, // one picture across a spread:
{ id: 'pliego-recto', art: '{attr.art}', half: 'recto' }, // the left half, then the right
{ id: 'nieve', art: 'nieve', ink: 'ink', extra: (colour) => colophon(colour) },
];
const plate = ({ id, art, half, ink = 'white', extra = () => [] }) => ({
id, span: 'page', // an opener: a span heading always starts a page of its own
// The left half opens on an even page, a verso, so the right half faces it across the
// gutter (gotcha: parity-page1-recto).
...(half === 'verso' && { breakBefore: { enabled: true, parity: 'even' } }),
The composed script.js runs as it is: paste it into any page’s module script, or open the recipe on CodePen. Recipe folder on GitHub ↗ (opens in a new tab)
Variations
#Float plates opposite their entries
For plates that float to the recto facing a catalogue entry, with the figure’s width set from its proportions, see Catalogue entries facing their plates.
#Open an article on a bled photograph
For a photograph bled across the head of an article, with the headline and standfirst over it, see the magazine feature.
Pitfalls
Pitfall
Page 1 is a recto: plan pages with physical numbers
Page 1 is a right-hand page and page 2 the first verso, so plan spreads with physical page numbers: an opener on an even page faces the odd page after it. Page and column breaks →
Pitfall
No <marker> or filters in SVG art (raster fallback)
An SVG figure stays vector in the PDF only without <marker>, filters and masks; otherwise it falls back to a raster, and deeply nested filters can blank it in Chrome. Draw arrowheads as paths. Figures and tables as resources →
- Never cite a plate that a design draws. Cited, it also floats as a figure: a
:refto the noon plate in the first text puts a second copy of it on page 3, and the storm moves two pages on, after a blank page. - The dusk plate sits one line under its text, not at the foot of the page. On the closing page of a text, a float that lies below the text moves up to it (
layout.hugClosingFloats, on by default), andposition: 'bottom'changes nothing there. - Each text is fitted to one page in both editions. When the first runs on to page 3, the noon plate moves to page 4 and the storm to pages 6 and 7, after a blank page 5.
- The storm’s right half is a second
# Stormheading. The page prints no title for it, but a:::tocbuilt from the headings lists the storm twice, on pages 4 and 5. - The plates stop at the trim, which is the edge of the canvas. With
page.cutLineson, the canvas grows around the trim, and the bleed around each plate shows the paper colour. For print, anchor the plates to'bleed'and make each one larger by the bleed on every side.
Credits
- Recipe
- Ignacio Ferro
- Text
- The three texts, the captions and the colophon, in Spanish and English, and the six plates, drawn in code · Postext Cookbook · CC BY 4.0
- Images
- Plate I, dawn: ridges fading into a peach haze under a dark blue sky · Generated With Diffusion Models · original
- Plate II, noon: a granite cirque and its lake · Generated With Diffusion Models · original
- Plate III, storm: rain, lightning and a break of sun across a spread · Generated With Diffusion Models · original
- Plate IV, dusk: the crest lit orange under a violet sky · Generated With Diffusion Models · original
- Plate V, night: stars over the ridges and a lit refuge · Generated With Diffusion Models · original
- Plate VI, snow: the cirque of plate II the morning after · Generated With Diffusion Models · original
- Fonts
- Andada Pro (SIL OFL 1.1) · Syne (SIL OFL 1.1) · Syne Mono (SIL OFL 1.1)
Edit this write-up ↗ (opens in a new tab)Recipe folder on GitHub ↗ (opens in a new tab)


