Archived topic
GenerateBlocks Full Width Container - Rankmath FAQ not added to the schema
21 replies · Started by Kumar on December 7, 2020
Hi Tom,
I am using GB container block, I set up Rankmath FAQ within it. But when I check on google structured data tool, they don't seem to appear. Example in the below box.
Is this something you can help me with?
Thanks
Kumar
Hi there,
do they appear if you add the FAQ block to a normal page - ie. not in a container block?
Hi David
I have checked:
Rankmath FAQ doesn't work when inside GB container but works when outside.
Thanks
Kumar
Hi,
You can try this PHP snippet a user provided from one of the RankMath tickets.
https://support.rankmath.com/ticket/faq-schema-not-showing/#post-83248
Hi there
I added the below code in the Snippet plugin and it doesnt work. Is the code valid? Does it need tweaking?
"Adding this code snippet to functions.php solved the issue:
add_filter( ‘rank_math/schema/nested_blocks’, function( $nested ) {
$nested[] = ‘generateblocks/container’;
$nested[] = ‘generateblocks/grid’;
return $nested;
});"
Quick question - which version of GenerateBlocks are you using ? Is it the latest 1.2 release?
yes, thats right - Version 1.2.0
What happens if you use a Group Block ?
Hi David,
Yes seems to be working with the group block. but the width of the group block is 1080 and the rest of the article width is 700px as you can see in the link below.
Ok, so add this CSS:
.wp-block-group.narrow-container .wp-block-group__inner-container {
max-width: 620px;
}
I have set it to 620px to take into account the Container Blocks 40px padding.
Then select the Group Block and in Advanced > Additional CSS Class(es) add narrow-container
Please let us know if Rank Math get back to you on this.
Hi David,
Thanks a lot. That works great.
The only problem is, we already have it enabled on 80+ articles with the generateblocks container. Would be so manual to change them each one by one and add the class to each as well. Is there any easier way to make it work while inside the GB container block itself?
You would need to add the custom class to each block unfortunately.
Hi
I am currently facing the same issue. The mentioned workaround
add_filter( ‘rank_math/schema/nested_blocks’, function( $nested ) {
$nested[] = ‘generateblocks/container’;
$nested[] = ‘generateblocks/grid’;
return $nested;
});”
does not work.
Is the problem related to rank math or generatepress/generateblocks?
Would be great if this could work without switching to group block.
I wonder if it's because the quotation mark is wrong in your code.
Can you try this?
add_filter( 'rank_math/schema/nested_blocks', function( $nested ) {
$nested[] = 'generateblocks/container';
$nested[] = 'generateblocks/grid';
return $nested;
});
Hello Leo
thanks for your reply.
Seems to have been a copy and paste error from my side here. Should be without the quotation mark of course. Nevertheless the mentioned code does not work.