Link to a specific slice on the same page

It would be fantastic if I could specify the ability to link a slice within the same page. As a developer I'd love to be able to add an #id into the link address, but this is not a great experience for content editors.

I've got two concrete use cases for this.

  1. I am building landing pages that contain forms, those forms are rendered in a slice further down the page. I have a call to action at the top of the page and I would like to jump to the form when that call to action is clicked.

  2. I'm building documentation and the user may want to link to that specific section in a page. Much like linking to replies in the Prismic community.

If there is a way to achieve this already, I would love to find out about it.

Hey Ben, thanks for reaching out!

it is true that it can be useful to have such functionality built-in the Slices, what I'll do is mark this thread as an open feature request.

A workaround I can recommend would be to add a Key text field in your Slices to set an "ID" for each one. Then you can retrieve that value and assign it as the anchor href of the corresponding paragraph, and so create an anchor.

You could also set a label for the whole slice (read the section "Labels configuration"). The only difference with this approach will be that the label will be defined at the custom type level and won't be editable by your content authors.

This is being tracked as an open feature request.

If you have another use-case for this feature, you can 'Flag' this topic to reopen. Please use the :heart: button to show your support for the feature and check out our Feature Request Guidelines.