1

If I have a query that starts like this:

export const pageQuery = graphql`
{
homepage: wordpress {
  pages(where: { title: "Homepage" }) {
    nodes {
      isFrontPage
      blocks {
        name
        ... on WORDPRESS_CoreHeadingBlock {
          name
          attributes {
            align
            content
            level
          }
        }
        ... on WORDPRESS_CoreParagraphBlock {
          parentId
          name
          attributes {
            ... on WORDPRESS_CoreParagraphBlockAttributesV3 {
              content
              align
            }
          }
        }

whereby I could have dozens of different Gutenberg blocks coming through, and then repeating them as InnerBlocks, what is the right way to break this into fragments or better organize it?

I'm running into a situation where my query ends up hundreds of lines long to account for nested blocks.

I'm working on a WP Gutenberg block parser for Gatsby and don't quite know the right way to approach these block queries.

Thanks!

jacobdubail
  • 194
  • 2
  • 13

0 Answers0