Go Behind the Experience to see how Tecovas brings the West to life with Sanity 🀠 July 18th

Discussion about customizing a Sanity.io input and creating a template BackOffice for web development.

32 replies
Last updated: Dec 19, 2022
Hi ! I have created a custom Input that has a button which manipulates the value of the input.It is working but I have to press a letter in the input for Sanity to run the validator and allow me to publish the post.Otherwise, the "Publish" button stays disable even though everything is ok.
How can I manually run the Sanity validator ?
Thanks a lot !
Nov 20, 2022, 4:10 PM
I think the more important question is: what does the validation do at the moment?Seems like there might be something setup in a unfortunate way
πŸ™‚
Nov 22, 2022, 12:04 PM
The more you share the faster we can help πŸ˜‰ (slick code examples help too)
Nov 22, 2022, 12:04 PM
Hi and thanks for the answer !Actually, I have created a custom component to generate a slug based on the page title, but then I have figured it out that I can have the same result by just adding "slugify" to options object
Nov 22, 2022, 12:06 PM
Thanks πŸ™‚
Nov 22, 2022, 12:07 PM
Wonderful! There are some neat things you can do with slugs, BUT I would not hardcode parents into the slug:1. You need the slug to work even when the parent changes (seo etc. will suffer if you dont do so)
2. your front-end should handle this, so you can change your content / data without having to change your whole frontend with it.
What kind of frontend are you using?
Nov 22, 2022, 2:10 PM
I will use a SPA & SSR front end, using Next framework
Nov 22, 2022, 2:12 PM
Thank you for your suggestion. Actually I am working, and this topic is about a personal project, so, after work I will carefully read and think about my options.Thanks very much Saskia !
Nov 22, 2022, 2:19 PM
Especially there you do not need any slug with breadcrumps: since you have folders as subpages, use the query with filters and nextJs will do the rest for you
Nov 22, 2022, 2:26 PM
true point ! Thank you !
Nov 22, 2022, 3:22 PM
Its always better to handle those in the FE, because then you have bigger content velocity:lets display this blogpost in
<http://yourpage.com/NAMEOFTHEPOST|yourpage.com/NAMEOFTHEPOST>
and later / or also on
<http://yourpage.com/blog/NAMEOFTHEPOST|yourpage.com/blog/NAMEOFTHEPOST>
and maybe even in your app, and your XY. See what i mean? the bread crumps will lead you into a one way street, only the slug (which also has the HANDY feature of saving different versions of your slug since
slug.current
) can be mixed and matched, will have amazing for seo (verbose urls) and well safe you A LOT of time at some point.
Nov 22, 2022, 5:32 PM
Thank you very much Saskia !To be honest, I was so focused on Sanity and what can I offer to my clients that I ended up forgetting the "big picture" and if some feature makes/not makes sense in my particular stack.
I am a front-end developer that would like to start a side-job doing some web-sites that has sanity as BackOffice.
For that I am taking some time to add a wide variety of features to a "template BackOffice".
Nov 22, 2022, 6:08 PM
By the way: I have created some blocks (hero, gallery, etc) to pages and in a blog listing page.I would like to add a "listing" block so that the user could change the order of the blocks, and place some block under/above the listing.
I was thinking about giving the user the opportunity to choose the listing layout (row/grid).
Then I wonder: Is it possible to have like a UI that I manually place the blocks in ? Like elementor, in wordpress
πŸ˜‚And the reason is to offer the user the possibility to have a block in a sidebar, for example.
I can always set a dropdown with layout options but...
Nov 22, 2022, 6:09 PM
And the reason is to offer the user the possibility to have a block in a sidebar, for example.I can always set a dropdown with layout options but...
Nov 22, 2022, 6:12 PM
Well, you need to rethink what you know about Wordpress and other CMSes and take the structured content :sanity_with_3_hearts: approach: Since everything is data, you can setup an array of page sections and let them mix, match, shuffle and change, whatever they want 😎
Nov 22, 2022, 6:16 PM
Ok, thanks a lot Saskia, once again πŸ‘
Nov 22, 2022, 6:17 PM
As an inspiration: Some of my (older) work
Nov 22, 2022, 6:20 PM
BTW: previews are your best friend here and will take a lit of time, but they are worth the extra step, so people can more easily find their way
Nov 22, 2022, 6:23 PM
yes ! It's on my list ! I like visual content, so I will definitely include them !
Nov 22, 2022, 6:24 PM
I have been watching some youtube videos as inspiration
Nov 22, 2022, 6:26 PM
For previews?
Nov 22, 2022, 6:40 PM
no, for the Backoffice features, in general.
Nov 22, 2022, 6:50 PM
I am brand new on sanity world, and on the structured content approach (as you already got)
Nov 22, 2022, 6:51 PM
I am a front end developer... but a curious one ahah
Nov 22, 2022, 6:52 PM
The beauty is that sanity is more JAM stack then full stack, so based on front-end logic basically πŸ™‚ (at least for you users)
Nov 22, 2022, 6:56 PM
I took an udemy online course about Sanity. A bad one, by the way... All I am learning in from your documentation which is very helpfull
Nov 23, 2022, 7:24 PM
Yeah same ... Learnt the most from docs etc. But react I learned from travery media :) Who gives the udemy course you did not enjoy ?
Nov 24, 2022, 12:44 AM
But I can really recommend our YouTube channel as well. We have a lot of amazing tutorials, meetups and idea driven things like the structured content conf
Nov 24, 2022, 12:49 AM
the react course I took was very good. react + next
Nov 24, 2022, 2:53 PM
Hey ! Could you please share with me a link that explains how to place an image next to the icon, on the preview ?I can only place one media in the preview (the block icon).
Dec 19, 2022, 10:15 AM
I need to do that and find a good fallback UI when the user dont insert title, for example
Dec 19, 2022, 10:16 AM
Thank you very much !
Dec 19, 2022, 10:16 AM

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?