The Prismic CMS has many options to define data, but is much simpler than what we had before. Through the hydrate you have many ways of using this data in different places.
Pages and slices can both use the .getInitialProps
function which is also provided with Next context.
Home.getInitialProps = async ({ context }) => {
return { locale: context.locale };
}
If a slice is in the object (so dynamic from the CMS), .getInitialProps
is also provided with slice data.
Slice.getInitialProps = async ({ context, sliceData }) => {
// Do anything with the context or sliceData
return { ... };
}
Last modified | Monday, August 30, 2021, 2:00:02 PM UTC |
Last author | Colin van Eenige |
Commit ID | fd08685 |