Zero One Documentation
Theme demo
  • Overview
  • Terms & Guidelines
  • Guide
    • Installation & Setup
      • Local environment
      • Server
      • Default language!
      • Multilanguage website
      • Config options
      • SMTP email options
      • Folder structure
      • htaccess
      • Updating
      • PHP Composer
    • Administration panel
      • Translating panel
    • Site options
      • SEO options
      • Multi-language
    • Theme styling
      • Less/CSS setup
      • Changing Less variables
      • app.less file
      • Customizing elements
      • Helpful classes
    • Page types
      • Page options
    • Blog
      • Comments
      • Article
    • Work (Portfolio)
      • Project page
    • Shop
      • Snipcart
    • Layout Builder
      • Column Options block
      • Subgrid block
      • Card block
      • Text (Writer) block
      • Custom Heading block
      • Custom List block
      • Typed Text block
      • Quote block
      • Button block
      • › 25 more blocks
    • Form Builder (Premium)
    • OLD Page Builder deprecation
    • Tricks
      • Using icons in the content
      • Kirbytext link tag to button
      • Tricks with image classes
      • Adding Google Fonts
      • Custom icons
      • Cookie notice/banner
    • Theme extending
      • Page Transitions (Swup)
      • Contact form extending
      • Self-hosted fonts
      • Adding new templates
      • Adding new Content block (Layout Builder)
    • GDPR
  • More
  • Support
  • Hire us
  • Changelog
  • Credits
  • Affiliate
Powered by GitBook
On this page
  • Creating new Content block
  • Including new Content block

Was this helpful?

  1. Guide
  2. Theme extending

Adding new Content block (Layout Builder)

How to add new Content block (Layout Builder)?

PreviousAdding new templatesNextGDPR

Last updated 16 days ago

Was this helpful?

Content blocks are used in many places, primarily in Layout Builder, but also in Page Builder content blocks (inside the Grid block, for example), in articles, Default template page, and other places.

Creating new Content block

To add a new Content block you must do the next steps:

  1. Add new block blueprint: site/theme/blueprints/blocks/yourblockname.yml

  2. Add new block snippet: site/theme/snippets/blocks/yourblockname.php

  3. After that just code that files, to do what you want them to do

Including new Content block

To include your new block to be available inside the panel:

  • If you want to add that block to Layout Builder

    • Copy site/plugins/zero-one/blueprints/sections/layout-builder.yml to site/theme/blueprints/sections/layout-builder.yml and add your block name to the fieldsets blocks list

  • If you want to add that block to Content blocks fields throughout the website:

    • Copy site/plugins/zero-one/blueprints/fields/blockEditor.yml to site/theme/blueprints/fields/blockEditor.yml and add your block name to the fieldsets blocks list

  • If you want that block to the Article template

    • Copy site/plugins/zero-one/blueprints/pages/article.yml to site/theme/blueprints/pages/article.yml and add your block name to the fieldsets blocks list

And that's it. Your custom block will be available. Only, it will have the default simple preview in the panel. If you want to create a better block preview you will have to create a simple plugin for that. Check this and check site/plugins/zero-one/index.js on how we built some previews.

Kirby docs Cookbook recipe