Get document display name

Hi! Is there a way to retrieve the display name of a document from a custom type inside the request?

I mean this one


Hey Emiliano,

No, the display name is not exposed on the API. Can I ask a little about your use case?


@samlittlefair Sure! I'm trying to pass to prismic.createClient the list of routes (I'm using Next.JS) in a dynamic way by fetching all the document by type (in my case, page - client.getAllByType("page"))

If I was able to use the displayName to generate the path of the document, I would end up using that field for the path from my side and my client would be able to order the documents by the same path (in the cms) in a simple and clear way (like in the screen) and I would end up using just one field for both cases, keeping things in sync.

Since this is not possible, for the moment I end up with this solution (I've added a slug field in the document page)

and now I have to keep in sync two fields, which is not the ideal solution from an architecture perspective.

That's clear! We probably won't make any changes in this direction any time soon, but I'll share this feedback with the product team. I know they're interested in looking at URL creation.

Thanks for sharing!