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"exportdefault ({ 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>)exportconstquery=graphql` query { site { siteMetadata { title } } }
Static Query
Allows non-page components (layout.js), to get data