Archived topic
A general question about GenerateBlocks
3 replies · Started by jm1991 on June 19, 2020
Hey there,
So my pages are a bit of a mishmash of GenerateBlocks modules, Wordpress modules and custom HTML.
I find it generally quicker to pick and choose when I use the GenerateBlocks container and headline modules. For example, I often create anchor links to my H3s and just use the Wordpress custom HTML module from the off to create an ID for a H3 tag i.e. I don't first use the GenerateBlocks container or the headline module. Or instead of adding a GenerateBlocks container first, I just copy and paste text which adds a Wordpress paragraph module by default I believe.
What are the implications of this? I can see that a class attribute is added from the off to GenerateBlocks modules, whereas, my hardcoded heading tags don't have a class, for example, so they can't be targeted with specific styling?
Should I be using GenerateBlocks containers to build every section / every paragraph?
Sorry for the long post, just trying to understand best practice here. I've submitted a sample page.
Hi there,
my best practice is to ( try and ) keep things as simple as possible.
Use core blocks for writing post content.
Use GB Blocks to create custom styled elements ( eg. a CTA ) within your post content or building landing pages where the page needs to be divided up into full width sections for example.
You can add Anchor/IDs to a core Heading block in Block settings > Advanced > HTML Anchor and to any GB Block in Advanced > ID. So no need for a HTML block to do that.
Classes are handy for identifying elements very specific elements. e.g h2 vs h2.my-custom-heading
GB adds unique classes to each block to specify any styles you set in that blocks settings. But you can add your own class to any Block in Settings > Advanced > Additional CSS Class.
Containers - no don't wrap every paragraph block in them. Keep them for dividing your content into specific sections or designing custom elements.
This is a great post! Thanks again. I think it would be beneficial to have something like this summarised up in an article somewhere for the GP community. Unless there's already something out there... I didn't quite find what I was looking for when I was searching around.
It's early days with GenerateBlocks and the Gutenberg editor keeps updating, but we should start preparing some blog content for this type of thing.
Glad to be of help.