NextJS Slicemachines link only allows "web" links

When using prismic normally, the "link" field allows 3 options - Web, Document, Media (unless you choose to refine it).

When using slicemachines it states that all 3 of these options are available

But when you actually publish your slice, you don't have the option to link to a document, or media item.

All you get are web links

@dan I had the same issue 2 weeks ago - it's an easy solution, however I don't understand why this is the default

Interesting. Given how it's required to specify which custom type relationships exist I can understand why this is the default but it's weird that you don't have the option to change it.

Based on @samlittlefair's comment on your post it sounds like it should be editable from within prismic slicemachine, but even on the beta branch (which I'm using currently) there's no option to allow document relations even with custom type options

I wonder what the 'correct' solution is here? Random document links won't work unless you define every document relationship in the initial query (very inefficient), so just deleting the web type here doesn't really work as a solution.

I guess a perfect solution would be for the linkable documents to be selected, which then automatically adds queries to your fetchLinks property but that's definitely not how this works now.

A simple solution is to use the Content Relationship field instead. It is designed only to link internal documents.

Unfortunately, that doesn't solve the problem of using these link fields on buttons, or other similar link documents that can be either document links (prefetched) or external links (regular links).

This is a pretty common use case, especially in situations like header/footer navigations.

That is true. I understand that having both links in a Custom Type instead of covering all of the use cases isn't the most user-friendly option. But it's a workaround you can use to make internal links work.

We appreciate all of your feedback. I'll be sure to share it on the team's product board.

For the moment, we'll need to wait for the new changes to be applied in Slice Machine

@dan Just wanted to point out that my solution does work and I've been using it for my latest client project without any problems

Hi Everyone,

Can you tell me what version of slice-machine-ui you are using?

Thanks.

OK, so I talked with the team and the field in this beta version of slice-machine-ui only supports 'links to web'. The content relationship supports 'links to documents' and neither supports 'links to media'.

I have requested the team to add support for all 3 of these cases to the link field. Hopefully this will be added in the next BETA release shortly.

I will update you here once this is done.

Thanks.

2 Likes

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