Skip to content

Commit

Permalink
docs(gatsby-source-contentful): add note about node_locale filtering (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Tunap Paul authored and pieh committed Jan 8, 2019
1 parent 3145efa commit e3d8285
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/gatsby-source-contentful/README.md
Expand Up @@ -171,6 +171,28 @@ Querying a **single** `CaseStudy` node with the ShortText properties `title` and
}
```

#### Duplicated entries

When Contentful pulls the data, all localizations will be pulled. Therefore, if you have a localization active, it will duplicate the entries. Narrow the search by filtering the query with `node_locale` filter:

```graphql
{
allContentfulCaseStudy(filter: { node_locale: { eq: "en-US" } }) {
edges {
node {
id
slug
title
subtitle
body {
body
}
}
}
}
}
```

### Query for Assets in ContentType nodes

More typically your `Asset` nodes will be mixed inside of your `ContentType` nodes, so you'll query them together. All the same formatting rules for `Asset` and `ContentType` nodes apply.
Expand Down

0 comments on commit e3d8285

Please sign in to comment.