Skip to content

Commit 07eeb2e

Browse files
LekoArtspvdzmeganesugatsbybot
authored
feat: File System Route API - General Availability (#27424)
Co-authored-by: Peter van der Zee <[email protected]> Co-authored-by: Megan Sullivan <[email protected]> Co-authored-by: gatsbybot <[email protected]>
1 parent 071d50d commit 07eeb2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1783
-608
lines changed

benchmarks/gabe-fs-markdown-route-api/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
"version": "0.1.0",
88
"license": "MIT",
99
"scripts": {
10-
"bench": "rm -rf generated_articles; gatsby clean; N=${N:-512} node gen.js; CI=1 GATSBY_EXPERIMENTAL_ROUTING_APIS=1 node --max_old_space_size=${M:-2}000 node_modules/.bin/gatsby build",
11-
"build": "GATSBY_EXPERIMENTAL_ROUTING_APIS=1 gatsby build",
10+
"bench": "rm -rf generated_articles; gatsby clean; N=${N:-512} node gen.js; CI=1 node --max_old_space_size=${M:-2}000 node_modules/.bin/gatsby build",
11+
"build": "gatsby build",
1212
"clean": "gatsby clean",
13-
"develop": "GATSBY_EXPERIMENTAL_ROUTING_APIS=1 gatsby develop",
13+
"develop": "gatsby develop",
1414
"format": "prettier --write \"**/*.{js,jsx,json,md}\""
1515
},
1616
"devDependencies": {

docs/docs/creating-and-modifying-pages.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ Gatsby makes it easy to programmatically control your pages.
66

77
Pages can be created in three ways:
88

9-
- In your site's gatsby-node.js by implementing the API
10-
[`createPages`](/docs/node-apis/#createPages)
11-
- Gatsby core automatically turns React components in `src/pages/*` into pages. Note that you must make the component the [default export](https://developer.mozilla.org/en-US/docs/web/javascript/reference/statements/export)
12-
- Plugins can also implement `createPages` and create pages for you
9+
- By creating React components in the `src/pages` directory. (Note that you must make the component the [default export](https://developer.mozilla.org/en-US/docs/web/javascript/reference/statements/export).)
10+
- By using the [File System Route API](/docs/file-system-route-api/) to programmatically create pages from GraphQL and to create client-only routes.
11+
- In your site's `gatsby-node.js` file, by implementing the API [`createPages`](/docs/node-apis/#createPages). ([Plugins](/docs/plugins/) can also implement `createPages` and create pages for you.)
1312

14-
You can also implement the API [`onCreatePage`](/docs/node-apis/#onCreatePage)
15-
to modify pages created in core or plugins or to create [client-only routes](/docs/client-only-routes-and-user-authentication/).
13+
Pages can also be modified by you after their creation. For example, you could change the `path` to create internationalized routes (see [gatsby-theme-i18n](https://github.com/gatsbyjs/themes/blob/1ddd07c4248239e6323833c6d6d572ac0a0d57a1/packages/gatsby-theme-i18n/gatsby-node.js#L132-L172) for instance) by implementing the API [`onCreatePage`](/docs/node-apis/#onCreatePage).
14+
15+
> **Note:** For most use cases you'll be able to use the [File System Route API](/docs/file-system-route-api/) to create pages. Please read on if you need more control over the page creation or consume data outside of Gatsby's GraphQL data layer.
1616
1717
## Debugging help
1818

@@ -264,6 +264,6 @@ export default Page
264264

265265
Page context is serialized before being passed to pages. This means it can't be used to pass functions into components and `Date` objects will be serialized into strings.
266266

267-
## Creating Client-only routes
267+
## Creating client-only routes
268268

269-
In specific cases, you might want to create a site with client-only portions that are gated by authentication. For more on how to achieve this, refer to [client-only routes & user authentication](https://www.gatsbyjs.com/docs/client-only-routes-and-user-authentication/).
269+
In specific cases, you might want to create a site with client-only portions that are gated by authentication. For more on how to achieve this, refer to [client-only routes & user authentication](/docs/client-only-routes-and-user-authentication/).

docs/docs/file-system-page-creation.md

-216
This file was deleted.

0 commit comments

Comments
 (0)