new Page(props, pageContext)
Template used during the page generation process.
This template first generate an object to keep track of every existing block in the project.
this object is hard coded as every existing blocks are known beforehand.
Then it extracts the body key from pageContext, which is a list of every blocks used in the page.
Using the bundle key inside each block and testing it against the blockResolver object,
it determines which block should be generated.
Parameters:
| Name | Type | Description |
|---|---|---|
props |
Object | Object containing all the page data |
pageContext |
Object | Object containing all page data |
- Source:
Example
// This exemple is pseudo code, for real code please check the component itself
// create the blockResolver object with every existing blocks/components
const blockResolver = {
b01 : <Block01/>
b02 : <Block02/>
b03 : <Block03/>
b04 : <Block04/>
b05 : <Block05/>
...
}
//Loop through the body array to create every block
//where bundle is processed to be equal to b01, b02, b03...
forEach bundle in [body]
display => blockResolver[bundle]