» » Gatsby data layer

Gatsby data layer

posted in: Dev Notes | 0

Following up my last Dev Note on Gatsby about Gatsby a CMS in Javascript and React..

Apart from the high level wrap up of layout, UI components, and routing, Gastby has also provided a user-friendly data layer. The data layer is powered by GraphQL, flexible and easy to use graphical interface GraphiQL to query data and do testing.

To pull data into a Gatsby site, we can simply use GraphQL queries and different plugins feeding data from different source to the GraphQL endpoint.

markdown-query

First, Source plugins bring files /into/Gatsby’s data system. scan all the file within our project and enable us to query all the files and their attributes with GraphiQL. We can also add custom attribute such as siteMetadata as global variables.

Second, /transformer/plugins transform raw content brought by source plugins. This pattern can handle all data sourcing and data transformation you might need when building a Gatsby site. gatsby-transformer-remark, for example, can convert a markdown file into a html script.

More on source file system plugin

Leave a Reply

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