Home Drupal Creating Lists of content with Gatsby and Drupal – Daily Dose of Gatsby Episode 4

Creating Lists of content with Gatsby and Drupal – Daily Dose of Gatsby Episode 4

1 min read
2
0
15



In this episode, we pick up where we left off last time and cover how to create lists of content on your Gatsby site by pulling data from a Drupal 8 website. You will learn:

1. How to filter and sort your GraphQL queries using GraphiQL explorer
2. How to create a list of your content
3. How to break up your list page into subcomponents

Links:
Daily Dose of Gatsby Episode 4 – https://codekarate.com/daily-dose-of-drupal/creating-lists-content-gatsby-and-drupal
CodeKarate.com – http://codekarate.com
Code Karate YouTube Channel – https://www.youtube.com/user/codekarate
Twitter account – http://twitter.com/smthomas3

Load More Related Articles
Load More By admin
Load More In Drupal

2 Comments

  1. Richard Gilbert

    October 16, 2020 at 2:38 am

    Hello Shane!

    This series has been invaluable for me — you explain everything so thoroughly! So, thank you for making these…

    At the 11:08 mark, you demonstrate how to refer to image relationships in a map of articles. I was able to do this in my test project just as you demonstrate. However, if one or more of my articles doesn't have an image, the following error is thrown:

    TypeError: Cannot read property 'localFile' of null

    This seems to happen right at
    image={article.relationships.field_image.localFile.publicURL}

    If I look at my graphiQL output, I am seeing `"field_image": null` on the article with no image — so, it stands to reason that it wouldn't be able to find a publicURL for it.

    My question is: how do we deal with these situations? Is it necessary, or even possible, to include a conditional within a map/loop?

    Thank you in advance for any advice you can offer.

    Richard

    Reply

  2. Oscar Mejia

    October 16, 2020 at 2:38 am

    Gatsby + Drupal Content ♥️

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also

I Registered My Domain, Now What?

I Registered My Domain, Now What? Start here ➜ http://bit.ly/2W7mimhGoDaddy You racked you…