How to best prevent rewriting slice content?

Hey Prismic Community

I'm running a prismic driven next.js shop with roundabout 20 Documents.
Most of them are Product pages and driven by 2 separate Documents.

  1. A generic Product_Page document that contains fields that exist on every product page. (button labels, navigation labels, general disclaimers, links)
  2. A document based on the Repeatable type Product which contains fields specific to one product that you can buy on the shop (product titles, images, descriptions).

This separation actually works quite well, until I started using slices. :pizza:
I frequently create slices on the repeatable Product type, which display information about the specific product (let's call them product-specific-slices) or a general benefit of buying products through this shop (let's call those generic-slices).
Naturally the generic-slices get repeated on multiple products while the product-specific-slices only occur on one product. This means that I have to copy paste the generic-slices from product to product. And if I decide to change the content of one of these generic-slices then I have to change them in all products where they've been mentioned.

Now I'm looking for a way to prevent this duplication of content and to manage this content more easily.
I already considered the following option, but it has clear disadvantages.

Adding generic-slices to the the generic Product Page document instead of the single Repeatable Product documents. But that makes it harder to find them on the Prismic backend, because they are now spread over two documents. This also makes it impossible to determine the exact order of the slices. And if I want to omit certain generic slice one one specific Product page, then I need to somehow exclude them afterwards.

I wish there was a way to define instances of a slice type and reuse them directly in your Documents.

The only way I imagine this to work is by creating slices that don't carry content fields but rather have a single content-relationship field that references a Repeatable type that contains the actual information. Does anyone have experience with this approach. Does it have any strong caveats?

Lucca

Hello @lucca, thanks for reaching out!

An available option is to arrange your slices through variations. Variations allow you the flexibility to enable certain fields depending on the use case. This option is available if your project uses the Slice Machine.

Hey @lucca did you find a solution for your specific use case? I am having the exact same issue at the moment and was wondering how to solve it.

I don't know if the variations mentioned actually solve the issue because if I understand it correctly, you still end up with duplicating the content itself.

@Pau
I haven't tried variants yet, as i'm not actively using Slice Machine. But based on the documentation it sounds like it allows me to change the structure the the slice but it won't help me rewriting the content of those slices. Right?

So as @matthias.ackeret mentioned, the content would still need to be repeated manually.
@matthias.ackeret I haven't tried out the "slice variant approach" nor my aforementioned approach of referencing a content-relationship inside of a slice. But I will update this thread once I've tried it out. Sadly it may take a couple of weeks until I have time to do so.

Yes, it's true, documents are individual entities. So the content for each one can't be reused in other docs unless you use a Content Relationship field.