Repeatable Type - Accessibility of slices on Prismic (some yes, other not)

I was wondering, is it possible on the same page, to make some slices accessible through Prismic's CMS while some other slices remained at a component level and not accessible through the CMS?

In other words:

In a repeatable page blog_post, I have components A, B, C displayed on it.

I want to create a slice of components A & B, but the component C should not been accessible to the content management team (for instance, component C is an automated component "Similar blog post").

Do I still have to create a slice of component C?

Thank you!

Hi Claudia,

It depends on your use case, do you still want people to be able to decide on the positioning of the "Similar blog post" component? If so, you'll need at least a 'placeholder' for this Slice in Prismic.

If the "Similar blog post" component won't be placed inside the Slice Zone then there's no need to create it with Slice Machine and/or add it to Prismic.

Does that clarify things?

Hello Phil, and thank you for the quick reply!

So basically, the “similar blog post” shall not be edited at all nor it's position.

The idea for the “similar blog post” is to be the same on all Blog Posts. Hence, is there a cleaner solution than me creating an “empty slice”* that should be added in each Blog Post manually?

If the "similar blog post" component is not placed inside the slice zone how can it be run accordingly in a dynamic custom type page?

Thank you again!

So what you would do is have a second query on your page for blog posts that don't contain the current document. You can use the not predicate to eliminate the current doc by passing it's ID to the second query.

prismic.predicate.not( document.id, post.id )

Then pass the content of this result to a new component to show the Articles, sort of like we do in the blog example:

1 Like

Thank you Phil, I will try that!

1 Like