Skip to main content
Version: 0.1.x

Introduction

not implemented
obsolete: probably being removed entirely due to os2.0 structure

// TODO: Do we scrap the page script concept entirely? Doesn't seem to be well used currently

Pages are a special type of limited component which is tied to a particular page type in the theme. For instance, a ProductPage would run whenever a /products/... page is loaded.

Pages are similar to components in that:

  • They have similar lifecycle hooks (beforeCreate, ready, etc.)
  • They have access to the same helpers like logging, cart state, etc.

Pages differ from Components in the following ways:

  • Only one Page is ever run per pageload, and only once.
  • Pages accept extra contextual information specific to the type of page they are (i.e. a product page receives metadata about the product context.)

Directory structure

All pages are defined under src/pages:

src/
└─ pages/
└─ FooPage.ts - Page class
src/
└─ pages/
└─ FooPage.ts - Page class