Creating a new Gatsby site:
gatsby new my-gatsby-site
A comprehensive cheat sheet for Gatsby, covering essential concepts, APIs, and commands to build performant React websites.
Creating a new Gatsby site:
|
Starting the development server:
|
Building for production:
|
Serving the production build:
|
Cleaning the cache:
|
Gatsby CLI help:
|
|
|
|
|
|
|
|
GraphQL |
Gatsby uses GraphQL to query data. The |
Data Layer |
Gatsby’s data layer is built on GraphQL and allows you to source data from various sources like Markdown files, APIs, and databases. |
Plugins |
Plugins extend Gatsby’s functionality, such as adding support for different file types (e.g., Markdown) or connecting to external APIs. |
Using
|
Using page queries (for pages):
|
Site Metadata |
|
All Markdown Remark |
|
File Query |
|
Image Sharp |
|
Filtering |
Use the
|
Sorting |
Use the
|
|
|
|
|
|
|
|
Plugins are configured in
|
StaticImage Component |
|
GatsbyImage Component |
|
|
|
|
Gatsby sites can be deployed to various platforms like Netlify, Vercel, GitHub Pages, and AWS Amplify. Netlify and Vercel offer excellent built-in support for Gatsby. |
Deploying to Netlify:
|
Deploying to Vercel:
|
Meta Descriptions |
Use |
Structured Data |
Implement structured data markup (Schema.org) to help search engines understand your content. |
Image Optimization |
Use |