A Payload site, ready to clone

Block generator

A new block for editors, with its fields, its look and its place in "Add block", written by one command.

What it does

Most projects need blocks of their own: a promotion, a room card, a testimonial. They live in the project’s block package, beside the site’s folder, so a template update never touches them. pnpm make:block writes one there: its fields, its admin texts in the package’s languages, a plain first version of its look that follows the site’s themes in light and dark, a second style on the accent colour, its category and a drawing in "Add block", and a test. When the project has no block package yet, it creates one and connects it to the site.

Fields can be text, rich text, numbers, yes or no, a choice from a list, a date, an image, a typed address, a link, or a page, post or other document of the site. A date is shown in the page’s language. A related document is shown by its title and linked to it in the page’s language; one that isn’t published or translated there shows no link. A link is the same field the collections have: a page of the site or any address, its own text, and whether it opens in a new tab. A field called heading is the block’s heading, with the heading level editors choose. A link is checked when it is saved and again when it is shown, so a dangerous address never reaches the page, and a link to another site opens in a new tab with the hidden notice screen readers announce.

It checks before writing: a name another block has, a prefix someone else uses, or a file it can’t edit safely stop it with nothing written. Adding a second block leaves the first one and the site’s connection as they were.

A block generated with a field missing or wrong is generated again with the same command, changed, and --force. It rewrites only the files nobody has edited since they were generated: each one carries a fingerprint of what the generator wrote. An edited file stops it, named, and nothing is written.

See it in the demo

This is a tool for whoever builds the site, so there is nothing to click here. In a project, run pnpm make:block --help for every option, or add --dry-run to see the files it would write. The README section "Generators" lists what it writes.

For whoever works with Claude Code, the apex-make-block skill drives it: describe the block, answer one round of questions, check the plan, and it writes the block and runs the checks. Then it offers to write the block’s real design within the front-end style guide.

For developers

The generator is scripts/make-block.ts, with its logic in src/lib/generators/ (makeBlock, blockFields, blockFiles, blockPackageEdits, blockPlan; pure and tested). It edits the package’s index.ts, components.ts and catalogs, and the project’s dependencies.json, project.config.ts and project.components.ts, through TypeScript’s syntax tree. A new package has the shape of @omitsis/apex-block-example. After it: the sync (the package is vendored), pnpm install, pnpm check:project and pnpm audit:blocks. No migration: blocks are stored as JSON. The skill is in .claude/skills/apex-make-block/, and a test checks it names every option. A related document’s URL is computed by the site, not the package: src/blocks/relatedHrefs.ts gives every populated document in a package block’s data its href in the page’s locale, with the document templates’ resolver.

One block, every feature page

This strip is a reusable block: written once and placed at the end of every feature page. Edit it under Reusable blocks and all of them change.

All features