A page is created by calling the createPage action. There are two main side effects that occur when a page is created.
pagesredux namespace is updated
componentsredux namespace is updated
onCreatePageAPI is executed
Update Pages redux namespace
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 plugin that created the page by adding a
Update Components redux namespace
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).
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.