You can use this code for create author page.
// packages/my-package/index.js
const profilePage = {
name: 'profile',
priority: 1,
pattern: '/profile/:user',
func: async ({
state,
link,
params,
libraries,
force,
}) => {
const response = await libraries.source.api.get({
endpoint: 'users',
params: { slug: params.user },
})
const data = await response.json()
state.source.data[link].isProfile = true
state.source.data[link].author = isEmpty(data)
? {}
: data[0]
},
}
export default {
.
.
.
actions: {
actions: {
init: ({ libraries }) => {
libraries.source.handlers.push(profilePage)
},
},
...
}
}