Adding a block
A new block takes three steps: a blueprint in the backend, a resolver if needed, and a component in the frontend. The cards block on the about page was built this way.
In the backend
Create
site/blueprints/blocks/cards.ymlwith the fields the block needs – here a structure of cards with title, image, text, and link. Then offer the block insite/blueprints/fields/layouts.ymlandsite/blueprints/fields/blocks.yml, so editors can add it in the Panel.If the raw field values are not enough, add a resolver to
site/config/blocks-resolver.php.cards:cardsturns each image UUID into image data and each page link into a path.
In the frontend
Create app/components/Kirby/Block/Cards.vue. Nuxt registers it as KirbyBlockCards; add its lazy variant to the map in app/components/Kirby/Blocks.vue, keyed by the block type cards.
The component receives the block as its block prop. Type it with KirbyBlock from kirby-types and describe the resolved content, so the template knows what the backend sends.