Page Types

Create a new file CustomRecordPage.js in the @/plugins/custom/page-types directory,

import definePageType from '@/lib/page-type/definePageType.js'
import getRecord from '@/lib/record/getRecord.js'

export default definePageType({
    id: 'CustomRecordPage',
    getPageData: async (ctx, { initialState, params, searchParams }) => {

        const { recordTypeId, recordId } = params

        // this might look unfamiliar
        // pages work with a normalized state object
        // the pros outweigh the cons
        // read more on this in concepts → state

        const record = await getRecord(ctx, { recordTypeId, recordId })

        let state = initialState

        state = addRecordsToState(state, recordTypeId, [record])

        return {
            props: {
                // notFound: true, // handles record not found
                // restricted: true, // handles not authorized

Then within the @/plugins/custom/page-types/index.js they're bundled into an array which can be imported from the plugins config.js

import CustomRecordPage from './CustomRecordPage'
import AnotherCustomPage from './AnotherCustomPage'
import YetAnotherCustomPage from './YetAnotherCustomPage'

export default ([

The page types are registered within @/plugins/custom/register.js

import definePlugin from '@/lib/module/definePlugin'
import pageTypes from './page-types'

export default definePlugin({
    // other configuration ...