5.14.0 • Published 2 months ago

gatsby-plugin-page-creator v5.14.0

Weekly downloads
474,414
License
MIT
Repository
github
Last release
2 months ago

gatsby-plugin-page-creator

Gatsby plugin that automatically creates pages from React components in specified directories. Gatsby includes this plugin automatically in all sites for creating pages from components in src/pages. You can also leverage the File System Route API to programmatically create pages from your data.

You may include another instance of this plugin if you'd like to create additional "pages" directories or want to override the default usage.

With this plugin, any file that lives in the specified pages folder (e.g. the default src/pages) or subfolders will be expected to export a React Component to generate a Page. The following files are automatically excluded:

  • template-*
  • __tests__/*
  • *.test.jsx?
  • *.spec.jsx?
  • *.d.tsx?
  • *.json
  • *.yaml
  • _*
  • .*

To exclude custom patterns, see Ignoring Specific Files

Install

npm install gatsby-plugin-page-creator

How to use

Add the plugin to your gatsby-config.js:

// gatsby-config.js

module.exports = {
  plugins: [
    // You can have multiple instances of this plugin
    // to create pages from React components in different directories.
    //
    // The following sets up the pattern of having multiple
    // "pages" directories in your project
    {
      resolve: `gatsby-plugin-page-creator`,
      options: {
        path: `${__dirname}/src/account/pages`,
      },
    },
    {
      resolve: `gatsby-plugin-page-creator`,
      options: {
        path: `${__dirname}/src/settings/pages`,
      },
    },
    // You can also overwrite the default behavior for src/pages
    // This changes the page-creator instance used by Gatsby
    {
      resolve: `gatsby-plugin-page-creator`,
      options: {
        path: `${__dirname}/src/pages`,
        ignore: [`foo-bar.js`],
      },
    },
  ],
}

Options

The plugin supports options to ignore files and to pass options to the slugify instance that is used in the File System Route API to create slugs.

OptionTypeDescriptionRequired
pathstringAny file that lives inside this directory will be expected to export a React component to generate a pagetrue
ignoreIPathIgnoreOptions ∣ string ∣ Array<string> ∣ nullIgnore certain files inside the directory specified with pathfalse
slugifyISlugifyOptionsPass options to the slugify instance that is used inside the File System Route API to generate the slugfalse

Ignoring Specific Files

Shorthand

The following example will disable the /blog index page:

// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-plugin-page-creator`,
      options: {
        path: `${__dirname}/src/indexes/pages`,
        ignore: [`blog.(js|ts)?(x)`],
        // See pattern syntax recognized by micromatch
        // https://www.npmjs.com/package/micromatch#matching-features
      },
    },
  ],
}

NOTE: The above code snippet will only stop the creation of the /blog page, which is defined as a React component. This plugin does not affect programmatically generated pages from the createPages API.

Ignore Options

The following example will ignore pages using case-insensitive matching:

// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-plugin-page-creator`,
      options: {
        path: `${__dirname}/src/examples/pages`,
        ignore: {
          // Example: Ignore `file.example.js`, `dir/s/file.example.tsx`
          patterns: [`**/*.example.(js|ts)?(x)`],
          // Example: Match both `file.example.js` and `file.EXAMPLE.js`
          options: { nocase: true },
          // See all available micromatch options
          // https://www.npmjs.com/package/micromatch#optionsnocase
        },
      },
    },
  ],
}
@yattho/gatsby-theme-rigitus@cangir/gatsby-blog-core@puzzledbytheweb/gatsby-theme-ecommerce-core@studiobear/gatsby-theme-blog@one-builder/gatsby-theme-ob-master@studiobear/gatsby-theme-blog-ionicgatsby-theme-ob-master@i1r0/gatsby-theme-nehalemgatsby-theme-kuworking-landing-onegatsby-theme-fierce-vanillaluandevtheme1gatsby-theme-lumengatsby-theme-css-modules-demogatsby-theme-memoriestorichegatsby-theme-not-important-bloggatsby-prosty-szablon-1gatsby-theme-1gatsby-theme-2gatsby-theme-portfolio-are.na@hesburgh-wse/gatsby-theme-marblegatsby-theme-typescript-storybookgatsby-theme-fencing@everything-registry/sub-chunk-1722gatsby-theme-blog-typescripttest-gatsby-theme-granderemigestemp-gatsby-themeitsalljs-docs-theme@divramod/gatsby-theme-ts-mdxjamie-sample-gatsbygxreact-ui-docsrp-websitetheme-component-shadowing-test@antv/gatsby-theme-antv@armada-inc/gatsby-theme-ghost-attila@ascorbic/gatsby@amorist/gatsby-theme-antd@atooni/gatsby-theme-ziodoc@atooni/gatsby-theme-ziosite@baronbeans/gatsby-theme-medal@basic-ui/gatsby-theme-docs@baradm100/gatsby-theme-admonation@bjerra/gatsby-theme-bd-salong@blacksparrow/gatsby-theme-blacksparrow@byteski/gatsby-midnight-theme@brisk-docs/gatsby-generator@adamwebster/tabini@7hci/gatsby-pge@codinators/gatsby-theme-blog@bonobolabs/gatsby@dexgroup/gatsby-theme-blog@davidway/gatsby-theme-not-important-blog@dayhaysoos/gatsby-theme-stripe-storefront@greatgatsbyjs/gatsby-theme-ggt-material-ui-blog@howtographql/gatsby-theme@hummingbird/gatsby-theme@g.vocale/gatsby-theme-memoriestoriche@ekafyi/gatsby-theme-musician@ethomson/gatsby-theme-npm-doctocat@fox-tech/doc@indirap/gatsby-theme-indira-1@infinitebrahmanuniverse/nolb-gatsby-plugin-p@kumarvaralakshmi/gatsby-theme-ghost@kuworking/gatsby-theme-kuworking-core@kriskaminski/gatsby-theme-krishalem@kyrelldixon/gatsby-theme-wpgraphql-tabor@kowalevski/gatsby-midnight-theme@lucasterra7/gatsby-theme-docs@lemonslicenebula/gatsby-theme-vlog@macko911/gatsby@lundgren/gatsby-theme-lundgren-blog@manduks/gatsby-robotois-academy@manduks/gatsby-robotois-store@mxkvl/gatsby-novemist-theme@mathieudutour/gatsby@marinda/gatsby-theme-recipes@nehalist/gatsby-theme-nehalem@nodox/gatsby@endormi/gatsby-theme-chaleur@exposuredesign/gatsby-theme-seen-alpha@exposuredesign/gatsby-theme-seen-test@exposuredesign/gatsby-theme-seen-test-alt@ericswanson/gatsby-theme-donations@eshlox/gatsby-theme-axii@dylanvann/gatsby@eggheadio/gatsby-theme-egghead-blog@mdrt/mdrt-theme-recruitment@moltin/gatsby-theme-moltin@josefaidt/gatsby-theme@ilearnbydoing/gatsby-wordpress-balsa-theme@ilearnbydoing/gatsby-wordpress-deva-theme@primer/gatsby-theme-doctocat@pusdn/gatsby-theme-antv@scaleph/scaleph-gatsby-theme@openeventkit/event-site@open-codes/opencodes@pinggod/gatsby-theme-wink@pauliescanlon/gatsby-theme-gatstats@pil0t/gatsby-theme-airplane
5.15.0-next.0

2 months ago

5.14.0

2 months ago

5.14.0-next.2

11 months ago

5.13.1

11 months ago

5.14.0-next.1

12 months ago

5.13.0

1 year ago

5.14.0-next.0

1 year ago

5.13.0-next.1

1 year ago

5.12.3

1 year ago

5.12.2

1 year ago

5.12.1

1 year ago

5.12.0

1 year ago

5.13.0-next.0

1 year ago

5.10.0

2 years ago

5.11.0-next.0

2 years ago

5.11.0-next.1

2 years ago

5.11.0

2 years ago

5.12.0-next.0

2 years ago

5.12.0-next.1

1 year ago

5.10.0-next.2

2 years ago

5.10.0-next.1

2 years ago

5.10.0-next.0

2 years ago

5.9.0

2 years ago

5.8.0-next.1

2 years ago

5.8.0-next.0

2 years ago

5.8.0

2 years ago

5.9.0-next.1

2 years ago

5.9.0-next.0

2 years ago

5.9.0-next.2

2 years ago

5.7.0

2 years ago

5.6.0-next.0

2 years ago

5.6.0-next.1

2 years ago

5.7.0-next.0

2 years ago

5.5.0-next.1

2 years ago

5.4.0

2 years ago

5.5.0

2 years ago

5.6.0

2 years ago

4.25.0

2 years ago

5.1.0-next.0

2 years ago

5.0.0

2 years ago

4.24.1

2 years ago

5.1.0

2 years ago

5.2.0

2 years ago

5.2.0-next.0

2 years ago

3.15.0

2 years ago

5.5.0-next.0

2 years ago

5.3.0-next.1

2 years ago

5.3.0-next.0

2 years ago

5.3.0-next.3

2 years ago

5.3.0-next.2

2 years ago

5.3.1

2 years ago

5.3.0

2 years ago

5.0.0-next.1

2 years ago

5.0.0-next.2

2 years ago

5.0.0-next.0

2 years ago

5.0.0-next.5

2 years ago

5.0.0-next.3

2 years ago

5.0.0-next.4

2 years ago

5.4.0-next.0

2 years ago

5.4.0-next.1

2 years ago

5.4.0-next.2

2 years ago

4.24.0

2 years ago

4.24.0-next.2

2 years ago

4.24.0-next.1

2 years ago

4.24.0-next.0

2 years ago

4.23.0-next.0

2 years ago

4.23.0

2 years ago

4.23.1

2 years ago

4.22.0

2 years ago

4.25.0-next.0

2 years ago

4.21.0-next.0

2 years ago

4.14.1

3 years ago

4.21.0-next.2

2 years ago

4.21.0-next.1

2 years ago

4.19.0-next.2

2 years ago

4.16.0

3 years ago

4.16.0-next.0

3 years ago

4.16.0-next.1

3 years ago

4.19.0-next.1

2 years ago

4.19.0-next.0

2 years ago

4.15.0

3 years ago

4.15.1

3 years ago

4.21.0

2 years ago

4.20.0

2 years ago

4.18.0-next.1

3 years ago

4.18.0-next.0

3 years ago

4.22.0-next.2

2 years ago

4.22.0-next.0

2 years ago

4.22.0-next.1

2 years ago

4.18.1

2 years ago

4.18.0

2 years ago

4.17.0-next.0

3 years ago

4.17.0-next.1

3 years ago

4.17.0

3 years ago

4.20.0-next.1

2 years ago

4.20.0-next.0

2 years ago

4.20.0-next.2

2 years ago

4.19.0

2 years ago

4.14.0

3 years ago

4.13.0

3 years ago

4.14.0-next.1

3 years ago

4.14.0-next.2

3 years ago

4.14.0-next.3

3 years ago

4.14.0-next.0

3 years ago

4.15.0-next.0

3 years ago

4.15.0-next.1

3 years ago

4.15.0-next.2

3 years ago

4.11.0-next.2

3 years ago

4.11.0-next.3

3 years ago

4.11.0-next.0

3 years ago

4.11.0-next.1

3 years ago

4.10.0-next.3

3 years ago

4.10.1

3 years ago

4.10.2

3 years ago

4.10.0

3 years ago

4.12.0

3 years ago

4.12.1

3 years ago

4.11.0

3 years ago

4.11.1

3 years ago

4.9.1

3 years ago

4.12.0-next.3

3 years ago

4.12.0-next.2

3 years ago

4.12.0-next.1

3 years ago

4.12.0-next.0

3 years ago

4.13.0-next.0

3 years ago

4.9.0

3 years ago

4.8.1

3 years ago

4.8.2

3 years ago

4.10.0-next.0

3 years ago

4.10.0-next.1

3 years ago

4.10.0-next.2

3 years ago

4.9.0-next.1

3 years ago

4.6.0-next.3

3 years ago

4.6.0-next.2

3 years ago

4.6.0-next.1

3 years ago

4.6.0-next.0

3 years ago

4.8.0

3 years ago

4.7.0

3 years ago

4.7.0-next.0

3 years ago

4.7.0-next.2

3 years ago

4.7.0-next.3

3 years ago

4.6.0

3 years ago

4.5.0-next.0

3 years ago

4.5.0-next.1

3 years ago

4.5.0-next.2

3 years ago

4.5.0-next.3

3 years ago

4.5.0

3 years ago

4.5.2

3 years ago

4.5.1

3 years ago

4.4.0

3 years ago

4.8.0-next.0

3 years ago

4.8.0-next.1

3 years ago

4.8.0-next.2

3 years ago

4.3.0

3 years ago

4.9.0-next.0

3 years ago

4.4.0-next.1

3 years ago

4.4.0-next.0

3 years ago

4.3.0-next.0

3 years ago

4.3.0-next.1

3 years ago

4.2.0-next.1

3 years ago

4.2.0-next.2

3 years ago

4.2.0

3 years ago

4.1.4

3 years ago

4.1.3

3 years ago

4.1.2

3 years ago

4.1.1

3 years ago

4.2.0-next.0

3 years ago

4.1.0-next.1

3 years ago

4.1.0

3 years ago

4.0.0

3 years ago

4.1.0-next.0

3 years ago

4.0.0-zz-next.2

3 years ago

4.0.0-zz-next.3

3 years ago

3.14.0

3 years ago

4.0.0-next.2

3 years ago

4.0.0-zz-next.1

3 years ago

4.0.0-zz-next.0

3 years ago

4.0.0-next.1

3 years ago

4.0.0-next.0

3 years ago

3.14.0-next.3

3 years ago

3.14.0-next.2

3 years ago

3.14.0-next.1

3 years ago

3.13.0

3 years ago

3.13.0-next.2

3 years ago

3.14.0-next.0

3 years ago

3.13.0-next.1

3 years ago

3.12.0

3 years ago

3.13.0-next.0

3 years ago

3.12.0-next.3

3 years ago

3.12.0-next.2

3 years ago

3.12.0-next.1

3 years ago

3.11.0

3 years ago

3.12.0-next.0

3 years ago

3.10.0

3 years ago

3.11.0-next.0

3 years ago

3.10.0-next.1

3 years ago

3.9.0

3 years ago

3.10.0-next.0

3 years ago

3.9.0-next.1

3 years ago

3.8.0

4 years ago

3.9.0-next.0

4 years ago

3.8.0-next.0

4 years ago

3.8.0-next.1

4 years ago

3.7.1

4 years ago

3.7.0

4 years ago

3.7.0-next.2

4 years ago

3.7.0-next.1

4 years ago

3.6.0

4 years ago

2.10.2

4 years ago

3.4.0-next.3

4 years ago

3.5.0-next.0

4 years ago

3.5.0-next.1

4 years ago

3.7.0-next.0

4 years ago

3.6.0-next.0

4 years ago

3.6.0-next.1

4 years ago

3.5.0

4 years ago

3.4.0

4 years ago

3.4.1

4 years ago

3.4.0-next.1

4 years ago

3.3.0

4 years ago

3.4.0-next.0

4 years ago

3.3.0-next.1

4 years ago

3.2.0

4 years ago

3.3.0-next.0

4 years ago

3.1.0

4 years ago

3.2.0-next.0

4 years ago

3.1.0-next.2

4 years ago

3.0.0

4 years ago

3.1.0-next.1

4 years ago

3.0.0-v3rc.0

4 years ago

3.1.0-next.0

4 years ago

3.0.0-next.2

4 years ago

2.10.1

4 years ago

3.0.0-next.1

4 years ago

3.0.0-next.0

4 years ago

2.10.0

4 years ago

2.11.0-next.0

4 years ago

2.10.0-next.1

4 years ago

2.9.0

4 years ago

2.10.0-next.0

4 years ago

2.8.1

4 years ago

2.9.0-next.1

4 years ago

2.8.0

4 years ago

2.9.0-next.0

4 years ago

2.8.0-next.2

4 years ago

2.7.2

4 years ago

2.7.1

4 years ago

2.8.0-next.1

4 years ago

2.7.0

4 years ago

2.8.0-next.0

4 years ago

2.7.0-next.1

4 years ago

2.6.0

4 years ago

2.7.0-next.0

4 years ago

2.5.0

4 years ago

2.6.0-next.0

4 years ago

2.4.0

4 years ago

2.4.0-next.1

4 years ago

2.5.0-next.0

4 years ago

2.3.35

4 years ago

2.4.0-next.0

4 years ago

2.3.34

4 years ago

2.3.33

4 years ago

2.3.32

4 years ago

2.3.31

4 years ago

2.3.30

4 years ago

2.3.29

4 years ago

2.3.28

4 years ago

2.3.27

4 years ago

2.3.26

4 years ago

2.3.25

4 years ago

2.3.24

4 years ago

2.3.23

4 years ago

2.3.22

4 years ago

2.3.21

4 years ago

2.3.20

4 years ago

2.3.19

4 years ago

2.3.18

4 years ago

2.3.17

4 years ago

2.3.16

4 years ago

2.3.15

4 years ago

2.3.14

4 years ago

2.3.12

5 years ago

2.3.11

5 years ago

2.3.10

5 years ago

2.3.9

5 years ago

2.3.8

5 years ago

2.3.7

5 years ago

2.3.4

5 years ago

2.3.6

5 years ago

2.3.5

5 years ago

2.3.3

5 years ago

2.3.2

5 years ago

2.3.1

5 years ago

2.3.0

5 years ago

2.2.4

5 years ago

2.2.3

5 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.46

5 years ago

2.1.45

5 years ago

2.1.44

5 years ago

2.1.43

5 years ago

2.1.41

5 years ago

2.1.42

5 years ago

2.1.40

5 years ago

2.1.39

5 years ago

2.1.38

5 years ago

2.1.37

5 years ago

2.1.36

5 years ago

2.1.34

5 years ago

2.1.33

5 years ago

2.1.32

5 years ago

2.1.31

5 years ago

2.1.30

5 years ago

2.1.29

5 years ago

2.1.28

5 years ago

2.1.27

5 years ago

2.1.26

5 years ago

2.1.25

5 years ago

2.1.24

5 years ago

2.1.23

5 years ago

2.1.21

5 years ago

2.1.20

5 years ago

2.1.19

5 years ago

2.1.18

5 years ago

2.1.17

5 years ago

2.1.16

5 years ago

2.1.15

5 years ago

2.1.14

5 years ago

2.1.13

5 years ago

2.1.12

5 years ago

2.1.11

5 years ago

2.1.10

5 years ago

2.1.9

5 years ago

2.1.8

5 years ago

2.1.7

5 years ago

2.1.6

5 years ago

2.1.5

5 years ago

2.1.4

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.13

6 years ago

2.0.12

6 years ago

2.0.11

6 years ago

2.0.10

6 years ago

2.0.9

6 years ago

2.0.9-alpha.0

6 years ago

2.0.8

6 years ago

2.0.7

6 years ago

2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

2.0.0-rc.5

6 years ago

2.0.0-rc.4

6 years ago

2.0.0-rc.3

6 years ago

2.0.0-rc.1

6 years ago

2.0.0-rc.0

6 years ago

2.0.0-beta.5

6 years ago

2.0.0-beta.4

6 years ago

2.0.0-beta.3

6 years ago

2.0.0-beta.2

7 years ago

2.0.0-beta.1

7 years ago

2.0.0-beta.0

7 years ago

2.0.0-alpha.4

7 years ago

2.0.0-alpha.3

7 years ago

2.0.0-alpha.2

7 years ago

1.0.2-0

7 years ago

1.0.1

7 years ago