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!

3 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

3 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.

2 Likes

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

2 Likes

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

Taking this lead I created a Dashboard that helps the team so much.

:point_right: https://fs-prismic-dashboard.vercel.app/

2 Likes

Very cool, Mohammad! Thank you for sharing this :slight_smile:

My hope is that the Prismic UI eventually makes this clearer, right out of the box, but this is a great solution for folks who need something now/today. Kudos!

2 Likes