DEV Community

Discussion on: How To Build A Blog with Wordpress and Gatsby.js - Part 3

Collapse
 
drsuave profile image
DrSuave

Thanks for this Tim, really informative stuff, very glad I found it - it should be on the official Gatsby site imo.

I've run into an interesting problem - after getting the blog and Gatsby set up with your instructions I started experimenting with different things, seeing how headers, blog post images etc are imported, and using ACF images as backgrounds to divs.

At some point during this experimentation new blog posts started appearing at the bottom of the index page rather than the top. The previous posts stayed in their same order, but anything new I add now goes to the bottom of the stack. Obviously I'd prefer new posts to go on top - where in the code should I look to start debugging this? I'm kind of in the dark!

Collapse
 
iam_timsmith profile image
Tim Smith

Thanks! I'm glad it is helpful. I'm in the process of getting it on the Gatsby blog.

As far as the sorting of the blog posts, you should do this in graphql query. You could put something like this:

allWordpressPost(sort: { fields: [date], order: ASC })

There are some docs about it on the Gatsby site that explain it pretty well.

Collapse
 
iam_timsmith profile image
Tim Smith