🧱 Gutenberg Blocks

Restricting to Page Templates

Limit blocks for usage within specific page templates

You can restrict an individual block type to only be used in certain page templates

To do this, just update your block's Templates property. You can have multiple templates, separated by commas.

/*
 * ...
 * Types: page, post
 * Templates: templates/my-cool-template
 * ...
 */
💡

Be sure to set Types: page, otherwise the block wont be available in the page template.

⚠️

Note that in above example, the block will be available on all posts, and all pages which have the template views/templates/my-cool-template.tsx.

Template Locking

Unfortunately this isn't possible at the moment... mostly due to Gutenberg being a bit crap.