Skip to main content

Page Creation

A page is created by calling the createPage action. There are three main side effects that occur when a page is created.

  1. The pages redux namespace is updated
  2. The components redux namespace is updated
  3. onCreatePage API is executed

Update pages redux namespace

The pages redux namespace is a map of page path to page object. The pages reducer takes care of updating this on a CREATE_PAGE action. It also creates a Foreign Key Reference to the plugin that created the page by adding a pluginCreator___NODE field.

Update components redux namespace

The components redux namespace is a map of componentPath (file with React component) to the Component object. A Component object is simply the Page object but with an empty query string (that will be set during Query Extraction).

onCreatePage API

Every time a page is created, plugins have the opportunity to handle its onCreatePage event. This is used for things like creating SitePage nodes in Internal Data Bridge, and for “path” related plugins such as gatsby-plugin-create-client-paths and gatsby-plugin-remove-trailing-slashes.


Edit this page on GitHub
Docs
Tutorials
Plugins
Blog
Showcase