Create Gatsby Static Pages Manually

Share this video with your friends

Send Tweet

Gatsby pages are created in different ways:

  • Automatically turns React components in src/pages into pages
  • Programatically using the createPages API in your site's gatsby-node.js
  • Using a Plugin That implements the createPages API

How to list all the pages in a Gatsby site

Gatsby will spawn a GraphQL server along with your dev server and you can use that to list all pages. Navigate to HOST:PORT/___graphql e.g localhost:8000/___graphql and past the following query.

{
  allSitePage {
    edges {
      node {
        path
        component
        pluginCreator {
          name
          pluginFilepath
        }
      }
    }
  }
}

In this lesson you will learn how to add React Components inside the src/pages folder for Gatsby to create pages from them automatically