Find all documents that use a particular slice?

Hey, Prismic community! Is there any way to find/query all instances of a particular slice across published documents? We're looking to retire/replace certain slices across hundreds of documents; we don't know whether they're being used anywhere, and if so, where. It looks like this has been requested before (please add another vote to the tally for me). Ideally this could be done via the UI, but if there's a more technical option in the meantime, I want to know about it!

2 Likes

Hey @dan.duett,

There is no way to do this in the UI. A technical solution would look very similar to the broken links solution. It would actually be a much shorter script. Let me know if it would be helpful for me to write an example script, and I can send it along tomorrow or Wednesday.

Best,
Sam

1 Like

An example script would be very helpful, Sam! I really appreciate you helping us systematically audit our existing Prismic content.

1 Like

Hey @dan.duett,

Here you go. Let me know if the script gives you any troubles.

https://stackblitz.com/edit/node-xztcnh?file=index.js

Sam

2 Likes

Thank you, Sam! I look forward to sharing this with my team and will let you know if I have any questions. I think this will really help us with current and future content audits.

1 Like

@dan.duett Glad to hear it! Feel free to re-open this thread if you have any further questions.

1 Like

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