Query issues with basic site structure


I have a problem identifying the type of document that I am querying. My URL structure is fully dynamic, which means that I cannot insert the type name into the URL. Is it better in my case to have multiple types or to do everything with just one type? The main problem, in that case, would be that the content posts will be difficult to navigate. Is that the case?


Hello @milosvu,

Welcome to the Prismic Forum. Thank you for reaching out.

To analyse the query, can you please provide the followings:

  1. Which framework, you are using and the related GitHub repo?
  2. An example of your use case?
  3. Prismic repository URL?


Hello @Priyanka!

We are using the standard approach available in your documentation, but could not find if we need to send "post type" within a query if we already use the UID. This becomes a problem when we have multiple types on the same level within the URL structure. Mainly, that is the use case.

Hello @milosvu,

You need to send the document type in API query like here. In getByUID, you need to send two parameters: one is document type and another one is uid. It is mandatory to send document type because different custom types can have the same uid.

Now for the another point of having multiple document types for the same level within URL structure:

(I'm assuming you are using nuxt framework)

  1. If DOM structure (rendering) is same for all URLs of types and Uid combination.
    For example: If you have folder structure like: /pages/:document-type/:uid, and two URLs like /type1/uid1 and /type2/uid2, then after getting different data results from getByUid query, same redering can be applied.

  2. If DOM structure (rendering) is not the same for all uid and document types combinations, you need to fix the document type in URL like /pages/type1/:uid, and /pages/type2/:uid.

It would be better if you can share the code with me.

Let me know if you have any other doubt.


1 Like

Thank you for your reply. Yes, that was helpful, we figured it out. :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.