Hi Priyanka; coming back to this after a long bit!
So, I'm looking back on my workflow for querying data, and it's become complex and the linkResolver
isn't cutting it, and I don't want to have to do a lot of work on my end setting up custom URLs as the content keeps growing; would rather use the route resolver, but I'm running into a little bit of a hiccup.
Essentially, like detailed above, I have lesson
documents, which don't have a top-level content relationship; courses
related to the lessons, but not the other way around, i.e.
course
- lesson1
- lesson2
Along with that, the lessons
are in a group field, as there multiple lessons related to each course. Like I said, I want to use the routeResolver
instead of linkResolver
. I've got it started like so:
routes: [
{
type: 'index',
path: '/',
},
{
type: 'courses',
path: '/:uid',
},
{
type: 'path',
path: '/:uid',
},
{
type: 'lesson',
resolvers: {
course: 'course',
},
path: '/learn/:course/:uid',
},
],
However, when I try and access a lesson now I receive this error:
Error: [Link resolver error] Invalid resolver course in page type lesson
The content relationship course doesnt exist on the top level of the custom type lesson
Is there a way around this so I can query the course relationship from a lesson?