Route Resolvers resolves to two paths for the same document

Hi there we are working on adding subpages on our website and we came across this problem.

We are using a field for the content relationships as explained in the docs.

const routeResolver = {
  routes: [
      path: '/:grandparent?/:parent?/:uid',
      resolvers: {
        grandparent: 'parent.parent',
        parent: 'parent',
      type: 'content_page',

The problem is that this config produces two valid URLs, for example, the same document resolves to two pages with paths. The expected one /grandparent_uid/parent_uid/child_uid and an unexpected one /child_uid.

Are we doing something wrong or is this an issue with the route resolver?

Hello @spyropoulos.a

Welcome to the community forum, and thanks for reaching out to us.

I found one issue in your route resolver at grandparent level. The value here should be like
parent. grandparent not parent.parent.

To dig it more, I need your folder structure.


Hi Priyanka,

parent.parent is OK as it is relevant to the field when we nest documents.

The target file is basically a typical src/pages/[[...uid]].tsx

We found out that the problem was a red herring. When we tested in preview mode, we could access a grandchild page from the route level and the grandchild level, as I described.

When we built the project, though, that wasn't the case. It worked as expected.