0

I'm learning gatsby and contentful to build a website but with when I query data from Contentful it displays the same content twice like below. what could be the reason?

enter image description here

npkp
  • 1,081
  • 5
  • 18
  • 24

1 Answers1

6

I just had exactly same problem here for my gatsby+contentful project. I guessed you have two locales set up in Contentful and it will automatically displays all languages you gave to it. To avoid that, you can simply add a filter in your query:

query { allContentfulBlogpost(filter: {node_locale: {eq: "en-US"}}) { edges { node { title node_locale } } } }

If you see only English show in node_locale that means you success!

Arghya Sadhu
  • 41,002
  • 9
  • 78
  • 107
min gong
  • 76
  • 3