I am doing a proof of concept for a small property letting agency using Next.js and Prismic. The purpose is to present available properties to potential tenants. Each property will have details such as rent, location, one or more images etc.. Prismic slices seem great for this as the business owner can enter the details for each property herself.
The web page will be simple, one landing page showing the properties through which a user can scroll (I intend to add pagination and filtering if possible).
I have set this up using a homepage and attached a slice for the property. In each slice is a repeatable zone so the business owner can add more than one image for each property.
As each new property comes on to the market the business owner adds another property slice and fills out the specific details. It sounds ideal.
There are currently not many properties, but the number is growing fast. I anticipate that this will become cumbersome very quickly. If we reach 100 properties we will have 100 slices under the homepage.
Perhaps this is something we will have to accept, but I was wondering if there was a better way to manage the slices. I note some of the example websites using Prismic have 300+ different products for sale and I assume each is a slice.
Managing a large number of items under a single homepage can indeed become cumbersome.
Here are some best practices and recommendations to help you manage your slices more efficiently:
Best Practices for Structuring a Slice
Structuring Your Slice Library:
Instead of adding a new slice for each property, consider creating a more structured approach. For example, you can create a single "Property List" slice that contains a repeatable zone for individual property details. This way, you can manage all properties within a single slice, making it easier to handle a growing number of properties.
Use Slice Variations:
Utilize slice variations to give editors the freedom to change a slice’s layout or fields. This can help in managing different types of properties or different layouts without creating new slices for each variation.
Human-Readable Display Names:
Ensure that your slices and fields have concise, informative names. This will make it easier for the business owner to manage and understand the content.
Incremental Merges:
When updating or adding new features, handle one slice at a time to avoid maintaining a large, divergent branch alongside production. This approach allows for incremental merges of new slices, ensuring a smoother process.
Reusability:
Focus on creating reusable slices that can be used across different pages or sections of your website. This will reduce redundancy and make it easier to manage content.
Example Structure
Property List Slice:
Repeatable Zone:
Property Name
Rent
Location
Images (repeatable field for multiple images)
Description
This structure allows the business owner to add multiple properties within a single slice, making it more manageable as the number of properties grows.
Alternative
Another option than maintaining the properties in the homepage document is to potentially create product items in Shopify and pull them in from there:
I hope these suggestions help you manage your slices more effectively. If you have any further questions or need more specific advice, feel free to ask.
This is very useful, thank you.
One question, though, is it possible to have a repeatable group within a repeatable group? I have tried this and the repeatable group option is not available when I try to add it.