Discussion about implementing routing in Sanity plugins and creating custom pages in Sanity Studio.
10 replies
Last updated: Jun 2, 2021
J
Anyone know of any sanity plugins that implements routing? Would like to see how it's done. Is using
@sanity/state-routerthe recommended way?
Jun 2, 2021, 5:50 AM
J
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.
But I can't work out how to link back to the base plugin page.
StateLinkworks with params,
IntentLinkworks with subpages. Say my base plugin is at
/foobar-pluginand i've navigated to
/foobar-plugin/:someIdhow do i provide a link back to
/foobar-plugin
Jun 2, 2021, 6:40 AM
J
ok solved, there's a
Linkcomponent
Jun 2, 2021, 6:43 AM
J
`<Link href={
/foobar-plugin}>Dashboard</Link>` for anyone wondering
Jun 2, 2021, 6:43 AM
P
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
P
In short i want in my sanity studio an page like
myapp.seedling.studio/mycustompagejust like we have
myapp.seedling.studio/desk. Is it possible buddy ?
user J
Jun 2, 2021, 10:23 AM
J
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
P
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
P
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
P
Question 1 - I want in my Sanity studio, an page like
myapp.seedling.studio/mycustompagejust 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
J
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.