Blocks
A block is a piece of HTML that editors can drop into a page in a couple of clicks. Build one for anything your pages reuse: a call to action, a pricing card, an alert, a team member, a question and answer, a two-column section with an image. Editors get the finished, styled component without touching code, and every copy of it matches your design.
Blocks fill a gap the toolbar can't. The editor makes headings, paragraphs, lists, images, and tables, but it doesn't know about your site's own components, because those depend on your classes and structure. A block carries that structure in. Editors insert it and change the words.
Blocks were called snippets in earlier versions.
Creating a block
Only administrators can create and edit blocks. Open the site, select Blocks in the sidebar, then select New Block. Each site can have up to 100 blocks.
| Name | What editors see in the list, such as “Call to action” or “Pricing card”. |
|---|---|
| Description | A line about what the block is for and where it belongs. Editors can search by it, so say what they'd look for. |
| Source | The full HTML of the block. Paste it in or drop an HTML file. |
Here's a call to action that editors can add to the end of any page.
<div class="cta">
<h3>Ready to get started?</h3>
<p>Tell us about your project and we'll be in touch within a day.</p>
<a class="button" href="/contact">Contact us</a>
</div>
The source is plain HTML. A block can't carry its own CSS, so the styles for .cta and
.button must already be in your stylesheet. Blocks land inside
content regions, so the same rules apply: no scripts, no server-side
code, no inline <svg>, and no custom elements. Use <img> for icons.
Elements at the top level of a block can't have an id attribute, and it's best to
avoid ids anywhere inside. A block that's inserted twice would give the page duplicate ids. Use classes
instead.
Inserting a block
In the visual editor, put the cursor where the block should go, select + in the toolbar, and choose Blocks. The Blocks panel opens. Start typing to search by name or description, then press Enter or double-click a block to insert it at the cursor.
Blocks can only be inserted into block regions. Inline, image, link, and other region types don't accept them.
Once a block is on the page, it's ordinary content. Editors can change its text, swap its images, add another copy, or delete it, and it publishes like anything else in the region.
Protecting the structure
Because an inserted block is ordinary content, an editor can also change the markup that holds it together.
To prevent that, lock it. Add cms-lock to the outer element and cms-unlock to each
part editors should be able to change. This pricing card locks its layout but lets editors change the plan
name, price, features, and button.
<div class="pricing-card cms-repeatable cms-lock">
<h3 class="cms-unlock">Freelancer</h3>
<p class="price"><span class="cms-unlock">$19</span>/month</p>
<ul>
<li class="cms-repeatable cms-unlock">10 websites</li>
<li class="cms-repeatable cms-unlock">Unlimited pages</li>
</ul>
<a class="button cms-unlock" href="/signup">Sign up</a>
</div>
The features are repeatables, so editors can add, reorder, and remove lines without touching the list markup. The card itself is repeatable too, so they can duplicate it for another plan and drag it into place. Combined this way, blocks, lockables, and repeatables let editors build out a page from components you designed, and the result always looks the way you intended.
Blocks are copies
Inserting a block copies its source into the page. Editing the block afterwards changes what gets inserted from then on, but pages that already have the block keep their copy. For content that has to stay the same on every page, such as a header or footer, use includes instead.