Routing
Creating routes
Gatsby makes it easy to programmatically control your pages. Pages can be created in three ways:
- In your site’s gatsby-node.js by implementing the API
createPages
- Gatsby core automatically turns React components in
src/pages
into pages - Plugins can also implement
createPages
and create pages for you
See the Creating and Modifying Pages for more detail.
Linking between routes
You can use gatsby-link
to link to these routes — this will provide almost-instantaneous page transitions via prefetching. More on Gatsby Link.
You can also use standard <a>
links, but you won’t get the benefit of prefetching in this case.
Creating authentication-gated links
If you don’t want all of your content available on the public web, Gatsby lets you create client-only routes that live behind an authentication gate.
In this section:
- @reach/router and Gatsby
- Location Data from Props
- Creating Dynamic Navigation
- Client-only Routes & User Authentication
Edit this page on GitHub