Skip to main content

Add pages

Pages live within the /src/pages/[locale] directory. [locale] is a dynamic route, which—when compiled—gets swapped out with the appropriate locale string in the URL ("en-US", "fr-CA", "pt-BR", etc.)

By default, an index page ("home page") and a sub-page will be created for you within the project. The home page, specifically, behaves slightly differently than sub-pages, so we'll outline each below.

Home page

Your homepage layout lives in /src/layouts/home/home-layout.jsx. Any content on the homepage must be built within this component.

Sub-pages

All sub-pages live within the /src/pages/[locale]/<sub-page-name> directory, and expect an index.jsx file as their source. (<sub-page-name> should be replaced with the name of your page, so /src/pages/[locale]/about, for example).

Creating new pages

The easiest way to create new pages is by using the corgi CLI:

npx @wethegit/corgi@latest page MySubPage

This will scaffold all the necessary files for authoring a new page: the page component itself, an SCSS module file, an index file which exports the page component, and all the appropriate locale data files.