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.
- A generic
Product_Page
document that contains fields that exist on every product page. (button labels, navigation labels, general disclaimers, links) - 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.
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