Duplicate This value is already used by another job_localization document (URL build with content relationship)

Hello there, I have a job_localization custom type that has it's URL built based on another custom type name (content_relationship). E.g:
jobs/data-analyst/montreal

the job_localization page "montreal" is linked to the page data-analyst (another custom type).

However, since I am creating jobs/data-analyst/montreal but also jobs/data-scientist/montreal, Prismic is considering it as a duplicated UID:
This value is already used by another job_localization document

How can I fix it and handle my current use case to scale?
Should I use a dummy field to create the slug instead of the UID? such as a Key text string?

Thank you!

Hey @Marving,

Could you share your routes array from prismic.js?

Are you using resolvers to construct your URLs? An example similar to your use case for the URL (/job/data-analyst/montreal) would be:

const routes = [
  {
   type: 'job_localization',
   resolvers: {
    job: 'job',
   },
   path: '/job/:job/:uid',
   }
 }
]

Assuming:
Custom Type: job_localization - montreal
Custom Type: job - data-analyst
With Next's App router, you would have your page data inside /app/job_localization/[uid]/page.js.

Try this and let me know.

Thanks,
Racheal.

Hello @racheal.orukele,

thank you for coming back to me. Actually, the solution for the duplicate value issue has been provided here: Multiple custom type at the same level [uid.ts] - #5 by Marving

We are indeed using a resolvers, we went with the tatic of adding a . to the uid, such as boston.data-analyst and boston.data-scientist in:

1 Like