Mock data for Content Relationship

Hey there,

Currently my storybook previews of some of my slices are broken because the mock data for content relationship is not set up correctly. When I go to the content relationship field in Slice Machine, then go to "Mock config" tab, it says "Mock Configuration not implemented".

Is this something on the todo list that is coming later on?


Hello @kris, yes, at the moment, the mock data configuration for Content Relationship fields is not yet implemented. That means it will add an automatic web URL value, such as:

 "example_content_relationship": { "link_type": "Web", "url": "" },

@Pau Thanks for the quick answer! Yeah, I also noticed that this is the case. Is there any recommendation to make storybook work for such slices or the only choice is that they wouldn't work for now?

There isn't a different option that you can use to the Content Relationship field for now. But, for the code snippets, you can display a regular anchor field just so you can see the actual link reflected on Storybook

<a href={Link.url(slice.primary.example_content_relationship)}>My Link</a>

I've added a note in the dev team's backlog so we can track this issue. Whenever there's any news about this being implemented we'll update this same thread.


Just wanted to flag that it's not only links. For example, I have a pricing tier custom type which I use for the pricing grid slice. I use fetchlinks to extract name, price, features, etc

1 Like

What kind of field does this Grid Slice contain?
Are you also getting errors in this one?

This thread has been closed due to inactivity. Flag to reopen.

@Pau The interesting uses case of using custom type in slices is sharing global contents in more than one slice.

1 Like