Pages

Pages group parts together. They represent a final assemblage of those parts. They need to specify a layout and corresponding parts (e.g. a sidebar, a navigation bar, etc).

Pages live in the ~pages/~ directory.

URLs

The URL for a Page is constructed based on the location of the page file within the directory hierarchy of the filesystem relative to pages/ directory; e.g.

  • / corresponds to pages/index.html
  • /about corresponds to either pages/about/index.html or pages/about.html
  • /posts/my-article corresponds to pages/posts/my-article/index.html

For convenience and if you mainly use static pages (in contrast to dynamic pages), you can shorten the file paths in the following way:

  • pages/my-article/index.html can be shorten to pages/my-article.njk

Static Pages vs Dynamic Pages

A static page is a 1-to-1 relation between files on the filesystem and generated pages. A dynamic page is a single page (a template) which used to generate more than one page on the website.