Gutenberg 3.9 was released last week with a new feature that allows users to group multiple blocks into reusable templates. The templates can also be exported and imported as a JSON file.
The idea of reusable templates is an expansion of the concept of dynamic reusable blocks that Gutenberg technical lead Matias Ventura proposed in June 2017. Reusability is even more powerful when applied to multiple blocks. The import/export capabilities make it possible for templates to be easily shared across WordPress sites.
If you want to test it, you can select multiple blocks by selecting the content inside a block and dragging outside the boundaries of the block to extend the selection to multiple blocks. The multi-select feature was originally added for the purpose of deleting or moving multiple blocks but it has now become indispensable for creating reusable templates.
This feature lays the ground work for a full-fledged layout builder in the next phase of Gutenberg development. Reusable templates should make it a breeze to build WordPress sites with pre-defined layouts that users and developers can share. They are much more intuitive to implement than page templates.
“Holy wow, imagine this: wp-blueprints.com, where people can group blocks together and share their JSON strings with nice little copy buttons,” Gutenberg designer Joen Asmussen commented on the PR. “Categories for top rated, most downloaded, search, etc? This is going to happen because of this magic.”
Matias Ventura’s demo video shows the reusable templates in action. It also highlights a new tool for visually comparing possible ways to convert an invalid block. The editor now includes a diff UI for blocks, which Ventura said could possibly scale in the future to provide an improved UX for revisions as a whole.
A few other notable additions in the 3.9 release include improvements to the drag and drop handle, collapsible groups for the block toolbar, and the ability to convert a cover image block to an image and back. Dark editor style support is now available for theme developers, making Gutenberg more friendly for use with dark WordPress themes. Check out the 3.9 changelog to see a full list of enhancements and bug fixes.