Knowing that it had to be an overview of all the articles, I started out by creating a resolver which would specifically group the specific data that I needed. In this case, articles & projects.
So I added the createResolvers function to my gatsby-node file, and created a resolver specific for my ContentfulSectionGrid content model. Here, I would add create a return name for the projects and articles.
This return value, would be the value of the gridResolver visible bellow. As an argument, this function would define the dataType I will be using to query for specific pages as my page structure has a field which defines what kind of page it is.
The resolver itself is very straight forward.
It defines a type, which is the expected return type, in our case ContentfulPage.
Next, we resolve our function by running a query for all entries with type ContentfulPage and then filter based on the mentioned pageType above. Followed by a sort on the title field in ascending order.
The final query
Now all we have left to do is query our ContentfulSectionGrid and we will be able to see our initialProjects and initialArticles field ready to query!