Gatsby: Demonstrate use of directly importing data (json & yaml) for simple data in tutorial plus recipee

Created on 17 Jan 2019  Β·  9Comments  Β·  Source: gatsbyjs/gatsby

People sometimes think you need to use graphql for everything including simple cases like using data from a json file.

We should emphasize that hard-coded data can be directly imported and that graphql is only necessary when you want db-like functionality e.g. filtering, sorting, pulling bits of data from connected data, and transforming data (images, markdown, dates, etc.).

Add this to the tutorial and recipes page. Perhaps a standalone page too.

@gatsbyjs/docs

help wanted documentation

Most helpful comment

@KyleAMathews if you don't mind i can whip up something and have the @gatsbyjs/docs go over it and fine tune the details. Sounds good?

All 9 comments

@KyleAMathews if you don't mind i can whip up something and have the @gatsbyjs/docs go over it and fine tune the details. Sounds good?

@KyleAMathews do you see this as a case of adding more pointers to existing docs or adding a new docs section somewhere?

We have the following docs on using Gatsby without GraphQL:

Maybe the only TODO here is to reference some of these docs from within the tutorial?

Edit: maybe we should bring @jlengstorf's example repo into the Gatsby monorepo?

This is a bit different than those pages. Those pages are about adding data to a page via pageContext. We're not telling people that they can also just do const data = require('../data/cool-data.json'). Which is sometimes all people want.

I haven't through through though how or where this should go though. Recipes would be a good place. I was thinking the tutorial but I'd have to look through that closely.

/cc @marcysutton

It looks like the "Data in Gatsby" page would be a good spot for this (and the intro on the tutorial landing page). It would help to clarify that Graphql is optional: https://www.gatsbyjs.org/tutorial/part-four/

ETA: I am reviewing the PR as well, and I think having a dedicated doc in addition to tutorial updates will definitely help! πŸ™Œ

@m-allanson my example was already brought over (thanks @amberleyromo!). https://github.com/gatsbyjs/gatsby/tree/master/examples/using-gatsby-without-graphql

There's already this page, just FYI, called "Using Gatsby without GraphQL":
https://www.gatsbyjs.org/docs/using-gatsby-without-graphql/

On Thu, Jan 17, 2019 at 5:50 AM Kyle Mathews notifications@github.com
wrote:

People sometimes think you need to use graphql for everything including
simple cases like using data from a json file.

We should emphasize that hard-coded data can be directly imported and that
graphql is only necessary when you want db-like functionality e.g.
filtering, sorting, pulling bits of data from connected data, and
transforming data (images, markdown, dates, etc.).

Add this to the tutorial and recipes page. Perhaps a standalone page too.

@gatsbyjs/docs https://github.com/orgs/gatsbyjs/teams/docs

β€”
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
https://github.com/gatsbyjs/gatsby/issues/11130, or mute the thread
https://github.com/notifications/unsubscribe-auth/Ae9o2v3KwDVT6S15JYE_x8khhpoDb3NRks5vEH-QgaJpZM4aFO-r
.

Hiya!

This issue has gone quiet. Spooky quiet. πŸ‘»

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

Thanks for being a part of the Gatsby community! πŸ’ͺπŸ’œ

it's being rebased and reworked

Fixed by #12634

Was this page helpful?
0 / 5 - 0 ratings