DEV Community

Cover image for Blog with Pagination - Guide to Gatsby WordPress Starter Advanced with Previews, i18n and more

Blog with Pagination - Guide to Gatsby WordPress Starter Advanced with Previews, i18n and more

Henrik Wirth on December 06, 2019

I figured, for further parts of the tutorial, it will make sense to implement the Blog now. So this part will show you how to create a Blog (post o...
Collapse
 
deadband profile image
Quent McCoy

First off, great work with this tutorial! Thank you for all your effort.

I thought I would mention a problem I was having and what I did to resolve it in case others have the same issue.

I had been running into this error:
TypeError: Cannot destructure property wpgraphql of 'undefined' or 'null'

I traced it back to the PostTemplateFragment and BlogPreviewFragment within the data.js file. Apparently, sourceUrl under 'FeaturedImage' as well as name and slug under 'author' need to be wrapped in 'node'. Example:

featuredImage {
      node {
        sourceUrl
      }
    }

and

author {
      node {
        name
        slug
      }
    }

Perhaps this is the result of a breaking change to wpgraphql?

After adjusting those fragments the project built successfully again.

Collapse
 
henrikwirth profile image
Henrik Wirth NeverNull

As of now (06. December) you can play around with the Blog-Pagination already here: gatsby-starter-wordpress-advanced....

This preview is already using gatsby-image processing which will be part of the next part. Stay tuned :)

Collapse
 
joelhassan profile image
Joel Hassan

Man, just wanted to say thank you so much! I've been trying this stuff out on an existing WP site and this has been so helpful.

Collapse
 
henrikwirth profile image
Henrik Wirth NeverNull

Glad it helps 🎊. Feel free to share what you are creating with it. Always interesting to see what people are building with Gatsby.