Data Integrations
Can be done without GraphQL
Use source plugins to get data from filesystem etc, then use transformer(transformer page) to
Checkout http://localhost:8000/___graphql for graphql interface
Pulling Data
Page Queries
live outside of the component definition — by convention at the end of a page component file — and are only available on page components.
gatsby-config.js
module.exports = {
siteMetadata: {
title: `Title from siteMetadata`,
}
}src/pages/about.js
import React from "react"
import { graphql } from "gatsby"
import Layout from "../components/layout"
export default ({ data }) => (
<Layout>
<h1>About {data.site.siteMetadata.title}</h1>
<p>
We're the only site running on your computer dedicated to showing the best
photos and videos of pandas eating lots of food.
</p>
</Layout>
)
export const query = graphql`
query {
site {
siteMetadata {
title
}
}
}Static Query
Allows non-page components (layout.js), to get data
Source Plugins
fetch data from sources like: Wordpress
File System
gatsby-source-filesystem basically gets you all local files in your gatsby folder with allFile and file query
Last updated