✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Discussion about implementing routing in Sanity plugins and creating custom pages in Sanity Studio.

10 replies
Last updated: Jun 2, 2021
Anyone know of any sanity plugins that implements routing? Would like to see how it's done. Is using
@sanity/state-router
the recommended way?
Jun 2, 2021, 5:50 AM
ok based on this I have something https://github.com/sanity-io/plugin-template-tool-with-routing/blob/master/template/MyTool.js
But I can't work out how to link back to the base plugin page.
StateLink
works with params,
IntentLink
works with subpages. Say my base plugin is at
/foobar-plugin
and i've navigated to
/foobar-plugin/:someId
how do i provide a link back to
/foobar-plugin
Jun 2, 2021, 6:40 AM
ok solved, there's a
Link
component
Jun 2, 2021, 6:43 AM
`<Link href={
/foobar-plugin
}>Dashboard</Link>` for anyone wondering
Jun 2, 2021, 6:43 AM
user J
Do you think that by this concept we can add an custom page in sanity studio ? or am i misunderstanding this concept.
Jun 2, 2021, 10:21 AM
In short i want in my sanity studio an page like
myapp.seedling.studio/mycustompage
just like we have
myapp.seedling.studio/desk
. Is it possible buddy ?
user J
Jun 2, 2021, 10:23 AM
Yeah it’s possible. It’s called a plug-in. Some info here but it's not extensive. I've had to hunt around the code to work out how to do some things. https://www.sanity.io/docs/plugins
Jun 2, 2021, 12:02 PM
user J
Okay thanks for the consent Jordie, really appreciate it. I got your point...moreover like are you trying to say that i need to creat my own plugin tool and render custom UI on that path?? Actually bit confused, it would be very much helpfull if you redirect me to specific docs or blog or solution.
Jun 2, 2021, 6:11 PM
user J
Okay thanks for the consent Jordie, really appreciate it. I got your point...moreover like are you trying to say that i need to creat my own plugin tool and render custom UI on that path?? Actually bit confused, it would be very much helpfull if you redirect me to specific docs or blog or solution.
Jun 2, 2021, 6:11 PM
Question 1 - I want in my Sanity studio, an page like 
myapp.seedling.studio/mycustompage
 just like we have 
myapp.seedling.studio/desk
 . Is it possible  ? Question-2 - For example, On that page i want my own UI and i will be having an button there for example. Is this scenaio possible .??
user J
Basically i need this like on that page i would be doing some other react stuff. Is this possible ?
Jun 2, 2021, 6:12 PM
Param I don't work for Sanity, just another community member. I haven't been able to find many docs or blogs on how to do it. There's stuff at the link I showed you. If you create your own plugin it will create a new page in sanity where you can put a custom react component and do what you want.
Jun 2, 2021, 11:41 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?