One of Gutenberg's most useful features is the ability to reuse blocks. You can turn any block into a reusable block, speeding up your workflow and helping to maintain your website’s look and feel.
In this tutorial, I will show you how to reuse WordPress Gutenberg blocks.
If you have a page or post and within it you have a paragraph, map, button, or anything that you are likely to want to use somewhere else on the site, instead of having to cut and paste from one page or post to another, you can save the content and easily reuse it anywhere else that you might need it.
These blocks can then be updated just once and those changes will show wherever you have used the block. This can save a lot of time and ensure that you don’t have outdated information lurking on some of your older pages.
For instance, you might want to have a weekly highlight that should appear on each post and be updated every week with a new link. You can do this very easily with the reusable block feature, without having to go to every post and update them all.
Video introduction to resuable blocks in Gutenberg
This video is normally only available to OSTraining members. It explains how to use resuable blocks in Gutenberg:
Getting started with resuable blocks in Gutenberg
- Simply add the block that you want to use.
- Click on the three vertical dots and then "Add to Reusable Blocks".
- You are then prompted to give the block a name.
Once this is done, you can use this block on other pages and posts.
- On a new page or post, go to add a block by clicking on the ‘+’ symbol on the left and then scroll down the options until you find "Reusable" with the intertwined arrows right at the bottom of the list.
You will find a list of all your reusable blocks and you can select the one you want.
You will be able to see what type of block each one is. Here the paragraph symbol indicates the simple text blocks. If you had chosen to create a reusable columns block then you will have something like this.
Alternatively, you can search for your reusable block using its name and select it that way.
These reusable blocks are now stored in the database and you can make changes to them and these changes will be reflected everywhere.
- Go to "Manage all Reusable Blocks". You will find a listing that looks very like a normal posts listing. So if you have made a spelling mistake or need to update a link, you can edit this information only once.
- Just click on the block title and you can edit it like you would any other post.
- If you decide you don’t want the block on one particular page to reflect the changes made to the reusable block, you can make it a regular block again and it will no longer be updated when you making changes to the reusable blocks.
Creating templates with reusable blocks
You can use this reusable blocks feature to create custom templates for posts and pages.
Because reusable blocks are essentially just posts and you can add some blocks and content to them, you can use them as fully-fledged templates.
- Simply create a new post and create a reusable block.
- Then go to the reusable blocks manager and open the block you intend to use as a template.
- Once you are in the manager, you can set up the block to have the layout you wish to use for all your posts or a specific type of post. For example, You can add a headline, introductory paragraph, image, quote, and gallery.
- To use this template, create a new post, click on the "+" sign and select the template from the reusable blocks section. You now have an editable and reusable template!
Summary of Reusable Blocks
In other posts about Gutenberg, I've been critical of some features. For example, the Columns feature is a mess. However, Reusable blocks are one of Gutenberg’s most powerful features. They are surprisingly easy-to-use. Reusable blocks promise to save a lot of time and make the creation of complex pages much easier.
More Gutenberg Reading
- Gutenberg is the Biggest Ever Open Source Software Launch
- How to Use the New Gutenberg Editor in WordPress
- How to Use Columns in WordPress Gutenberg Editor