Access Old UID of a document in Gatsby

Hello,

This article is really helpful at explaining how old URLs are stored on a document which helps with redirection: Error: This value is already used by another document - FAQs - Prismic People

But I can't figure out how to access old UIDs of a document within my Gatsby graphql query. Has someone encountered this before?

Thanks,
Kris

Hi Kristiyan,

Thanks for contributing to the Prismic community.

I not sure I understood your question, but If you mean that you want to retrieve old UIDs for a given document, then the answer is, it is not possible.

The article you have described does mention the opposite by doing :

[at(my.your-custom-type.uid,"old-uid")]

You get the new UID of a document. by providing the old UID.

But can you please tell us the use-case you need to get the old UID for?

Looking forward to your reply,
Fares

Thanks for the reply @Fares

My use-case would be to setup redirects for when/if the marketing team changes the URL, I would like to grab the old URLs and setup a redirect rule to go to the new URL.

Hi Kristiyan,

Have you managed to find an answer to your inquiry?

As far as I remember - no, but I was able to find a workaround. It's a shame that we can't see a history of the document's UIDs. I think it will be a really useful info to know (and you guys already know it under the hood, but not exposed to the public API I assume?)

Anyways, I think this thread is save to be closed. Thanks for the help

1 Like

This is being tracked as an open feature request.

If you have another use-case for this feature, you can 'Flag' this topic to reopen. Please use the :heart: button to show your support for the feature and check out our Feature Request Guidelines.