One of the benefits of building pages and posts with Gutenberg Blocks is the capacity to save them as templates. Making templates for Gutenberg is an extraordinary method to help accelerate the publishing process. There are a few different ways to make them. In this article, we'll see how to make WordPress Gutenberg block templates.
We'll cover two strategies for making them:
- Creating a design to add to your Gutenberg library to export or clone.
- Creating a design to copy and paste when you need to utilize it.
These techniques let us reuse the blocks only. No other settings will be included.
Why Create Gutenberg Templates
Whenever you've planned your page or post design you can save the list of blocks with their attributes to reuse. This gives you a head start on making your content since you don't need to focus on the design. WordPress Gutenberg Block templates permit you to have a reliable design.
The block template can have placeholder content. They can be static or dynamic. You can characterize the default condition of an editorial session. You can even import or export your templates as JSON files, so you can reuse your layouts on various sites or share them with others. You can lock them so users can add content however not change the blocks.
Method 1: Create a Layout Template
Layout templates let you utilize the multi-select component that was initially added to allow us to move or delete various blocks simultaneously.
We can choose and add one block at a time or multiple blocks at a time to our library of global reusable blocks. This makes it simple to export them as JSON files.
Example Layout Template
I’ve created an easy layout that I can use as a blog post, product review, etc. It’s simple to save this to the library to reuse.
Take your cursor on the first block you want to insert and drag your mouse to the last block in order to highlight them.
Over the first block, you’ll see three dots on the left. Click the dots and select Add to Reusable Blocks.
The green message bar across the top will inform that the block was created. Give the layout a good name that makes sense to you and select Save.
The message in the green bar will tell that the block has been updated. You’ve created the layout!
To use this block, create a new page or post and open the options (three dots). Under Tools, select Manage All Reusable Blocks.
This gives a list of all your blocks. Here, you can export and import your blocks as JSON files. Reusable blocks are global. If you edit, then you’ll edit the original. In order to keep the original and create a new post using the layout, you’ll need to export it, rename it, and import the layout.
Duplicate Posts
Thankfully, we have another option. A plugin called Duplicate Post adds a cloning feature for Gutenberg blocks.
In the Duplicate Posts settings, enable Blocks.
We now have a cloning option in the Blocks library. Clone the layout you want and then edit. Each layout is global, so you’ll have to clone and edit each time you want to use the layout.
Method 2: An Easy Alternative Way to Create a Gutenberg Template
This method is just an easy cheat, but it does work. First, make a layout that you want to reuse complete with any placeholder content.
Next, switch to the code editor. To do this, select the three dots in the upper right corner. Under Editor, select Code Editor.
Highlight and copy the code.
Paste the code into a text editor and save it for reuse.
When you are ready to use the template, simply create a new post, switch to the code editor, and paste the code.
So now you have a new post that you can start adding content to.
Finishing Thoughts
That is our way at how to make Gutenberg templates. The two methods mentioned here work incredible. I like that you can add pre-made content to your templates. This is amazing for placeholder text to show contributors what data goes where. Reusable templates are an considerable method to accelerate and smooth out your work process, and they're an incredible method to make page and post layouts to share.
On our website VWthemes, we have best WordPress themes available for you to create stunning WordPress websites. Our professional WP themes will let you create any kind of website like for your business or services or for a personal blog.