Code A Blog With Next.js and Sanity.io

  Рет қаралды 26,597

PortEXE

PortEXE

Күн бұрын

Пікірлер: 90
@AnthonyInSanDiego
@AnthonyInSanDiego 2 жыл бұрын
Your ability to explain and deliver technical content is god sent... Thank you!
@fran_sar
@fran_sar 3 жыл бұрын
Woooow! You are fast. But to the point, concise and awesomely useful! Thanks!!!!
@julianehiem3118
@julianehiem3118 3 жыл бұрын
You just gained another subscriber. This video is very timely for me. Thanks!
@vonvetur
@vonvetur 2 жыл бұрын
Just a small note: don't use divs as buttons (unless you actually add all the functionality and accessibility features to it). Even if you do not care about WCAG those links should be just tags. The ability to open it in the new tab, middle click on it, make it focusable, link preview in the browser etc.
@PortEXE
@PortEXE 2 жыл бұрын
Unless you specifically do not want any of that functionality.
@mahbubhasan1538
@mahbubhasan1538 2 жыл бұрын
Nice explanation and your video save my time. Love from Bangladesh
@LeslieDuan
@LeslieDuan 3 жыл бұрын
Great work, sir! Exactly what I expected. Very concise, straightforward and clear!
@yassinabdulla368
@yassinabdulla368 Жыл бұрын
Thank you very much it helped very much it was exactly what I was looking for
@avroml
@avroml 3 жыл бұрын
Excellent content, thank you kindly, sir! Clear and simple. Used your explanations as inline comments - concise and on the object.
@alevratract8301
@alevratract8301 Жыл бұрын
Love the tutorial, thank you!!
@davidcarrillojr7783
@davidcarrillojr7783 3 жыл бұрын
This is fantastic content!! I am researching how I can start a KZbin channel with similar styled tutorial videos!!! Well Done!!!!
@TheMarcoDahms
@TheMarcoDahms 3 жыл бұрын
Outstanding tut. I finally know now how to get data from sanity into the frontend
@SkillyLuckington
@SkillyLuckington Жыл бұрын
Your Repos Deserve Way more stars :)
@thecasualistplays
@thecasualistplays 3 жыл бұрын
Zackery, I needed this so much! Thank you big time!
@PortEXE
@PortEXE 3 жыл бұрын
Glad it helped. I hope to see your blog when it's done!
@thecasualistplays
@thecasualistplays 3 жыл бұрын
@@PortEXE Thanks man! It did and I'll shoot you a tweet or something when I can get something up!
@louierichardson123
@louierichardson123 3 жыл бұрын
Fancy seeing you here ;)
@corykelley3387
@corykelley3387 3 жыл бұрын
@@louierichardson123 🙌
@fixesdev
@fixesdev Жыл бұрын
This is a great video! Thanks a lot
@LifeSurf123
@LifeSurf123 2 жыл бұрын
This was great! Really helpful and applicable. Do you have more videos expanding on this?
@mylesy4048
@mylesy4048 2 жыл бұрын
Great tutorial and you're straight to the point 👍🏽 ps. maybe we can use next/link for routing next time :)
@agengo1
@agengo1 2 жыл бұрын
Thank you so much your video is very helpful
@lowpedia7023
@lowpedia7023 3 жыл бұрын
Very excellent, and straight-forward, thank you!
@maksymspaskyi9584
@maksymspaskyi9584 3 жыл бұрын
Very interesting! Looking forward your next videos.
@Play_Streams
@Play_Streams 2 жыл бұрын
Good stuff, straight to the point!
@erayozaydin3636
@erayozaydin3636 3 жыл бұрын
if sanity init doesnt work in powershell etc, write this code Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass and it works
@valentinbenitobousquet6166
@valentinbenitobousquet6166 2 жыл бұрын
Great + great + great tutorial
@RonaldShin
@RonaldShin 3 жыл бұрын
How do you deploy this to vercel? Since it has frontend and backend(sanity io) folder? Can you clarify this for me? I'm bit confused.
@dude101cool
@dude101cool 3 жыл бұрын
Thanks, dude, amazing tutorial
@AnthonyCandaele
@AnthonyCandaele 3 жыл бұрын
very helpfull tutorial. I'm planning to build my portfolio site with Next.js and Sanity, so I would love to see a portfolio on that.
@gabriellengoo8511
@gabriellengoo8511 2 жыл бұрын
How would you uses imageUrl for arrays? ( ps This tutorial was amazing thank you! )
@ceramic9h
@ceramic9h 3 жыл бұрын
Thank you for the tutorial Zackery. Is it possible if you could elaborate more on how to use getServerSideProps with SWR?
@teacher_med
@teacher_med 3 жыл бұрын
I really enjoyed this video thank you : )
@chriscrowd4946
@chriscrowd4946 3 жыл бұрын
Very well done! Thank you!
@yo1414
@yo1414 2 жыл бұрын
Very nice!
@usmanmunir1559
@usmanmunir1559 3 жыл бұрын
Cool content! Enjoyed
@filipevalentegomes2383
@filipevalentegomes2383 2 жыл бұрын
would have been nice to see how and where to deploy sanity, but great video
@rishabsharma5307
@rishabsharma5307 3 жыл бұрын
Great tutorial!
@faiyazrafeek2628
@faiyazrafeek2628 3 жыл бұрын
You just doing amazing, thank you :)
@ngamsomset
@ngamsomset 3 жыл бұрын
very very good video. thanks!
@mertgenc9890
@mertgenc9890 3 жыл бұрын
everything look great but why do you use windows instead of linux?
@PortEXE
@PortEXE 3 жыл бұрын
Linux isn’t a sufficient main OS for my needs. It has its niche uses though.
@mertgenc9890
@mertgenc9890 3 жыл бұрын
@@PortEXE Yes I understood. If adobe programs are compatible with linux one day, I will not use windows anymore.
@Rahman.Shahadat
@Rahman.Shahadat 2 жыл бұрын
Amazing
@Jawad_Siddiqui
@Jawad_Siddiqui 2 жыл бұрын
Thanks !!!
@Thororm
@Thororm 3 жыл бұрын
Very good, thank you!
@Ryan-mx4ll
@Ryan-mx4ll 2 жыл бұрын
Does it make a difference mapping the posts on a component instead of index? It works fine on index, but when I do the exact same thing in a component, it gives me an error saying posts.length is undefined (in useEffect)
@polypusdb9751
@polypusdb9751 Жыл бұрын
Yes it does, you cannot use getServerSideProps in a component, it needs to be passed down from the page instead, or you can do a fetch request in the useEffect, but it would not be a good solution
@cazterk
@cazterk 3 жыл бұрын
how do i limit the number of featured posts on the home page given I have a couple of them on the backend but just need a few to be displayed
@morrisrjc
@morrisrjc 2 жыл бұрын
is the getStaticProps function used throughout this video the only way to fetch data from sanity in NextJS?
@gideonolaiya6665
@gideonolaiya6665 2 жыл бұрын
No, you can also use getServerSideProps. But getStaticProps is used when you already have the data during build time(the time at when you are writing the code) getServerSideProps is used if you are getting data during fetch time, it's used for data that changes almost everytime.
@trongnhanle7658
@trongnhanle7658 2 жыл бұрын
how to create search functional with sanity
@darkamer3879
@darkamer3879 2 жыл бұрын
Can I host using Netlify.
@PortEXE
@PortEXE 2 жыл бұрын
You can if you set it up. Be sure to read the documentation to get an idea of what needs to be done.
@darkamer3879
@darkamer3879 2 жыл бұрын
Thank you so much
@edshav
@edshav 3 жыл бұрын
Hello, why are you using getServerSideProps for getting a single post, but not getStaticProps?
@PortEXE
@PortEXE 3 жыл бұрын
getStaticProps is only called at build time, meaning that if I update a blog post I would need to rebuild my app to see the changes. So it’s really just used for static site generation and not server side rendering like we want here.
@rishabsharma5307
@rishabsharma5307 3 жыл бұрын
@@PortEXE How about using Incremental static regeneration. We can pass a value to revalidate and by that next js can cache the result for certain period of time. And if we pass a value of 60 mins to revalidate then next js will hit the api after every 60 mins. That way, only 24 requests will be made to sanity cms which will ensure that we are always in our free tier of sanity.
@86thecake
@86thecake 3 жыл бұрын
Wouldn't using the sanityClient be a lot easier than using a long URL?
@PortEXE
@PortEXE 3 жыл бұрын
It’s better for new comers to understand exactly what’s going on instead of always abstracting via libraries.
@86thecake
@86thecake 3 жыл бұрын
@@PortEXE gotcha, thanks for the response! Subbed, your way of teaching is solid.
@amankrx
@amankrx 3 жыл бұрын
How will we fetch author->name here.
@Codesey
@Codesey 3 жыл бұрын
Cannot read property '0' of undefined. i am try your way for this problem but it did not work
@deadpatrices9074
@deadpatrices9074 3 жыл бұрын
Hi Codex, I had this problem for a while and in my case the error was caused by my forgetting the return in the else statement in file [slug].js' getServerSideProps function: if (!post) { return { notFound: true } } else { return {
@coops1348
@coops1348 3 жыл бұрын
dude great job, this helped me really get off the ground with levelling up my NextJS blog to implement Sanity, but please use semantic HTML like nav, section, article etc. It is really important we are demonstrating proper HTML usage
@grandpaonfire6834
@grandpaonfire6834 2 жыл бұрын
why is that?
@MrDBH72
@MrDBH72 3 жыл бұрын
I am completely stuck at the 20 minute mark. I cannot find any of the props and therefore nothing is rendered other than 404. The URL is exactly as you have written, but it still does not work... I am an apprentice and relatively new to this. If anyone could help me with this issue, I would really appreciate it!
@avroml
@avroml 3 жыл бұрын
I was struggling with the same thing. I debugged it first by by double checking the project ID (the first part of the URL) and the dataset name ("production" is by default, but you might have created your own dataset in Sanity, so check it in the sanity studio codebase's sanity.json what are your own values of "api": {"projectId" and "dataset"} Good luck!
@furkandemirbilek7192
@furkandemirbilek7192 3 жыл бұрын
thank you :)
@ahnaafarafee
@ahnaafarafee 3 жыл бұрын
Why are you using next/router instead of next/link ?
@PortEXE
@PortEXE 3 жыл бұрын
Preference
@rhmhr
@rhmhr 2 жыл бұрын
And if you want code input and highlighting to this project, check out: dev.to/hosenur/implementing-code-input-highlighting-in-next-js-sanity-blog-40he If you want to add tags to your posts, check out: blog.hosenur.dev/add-tags-to-your-sanity-io-articles
@eoincarrick7805
@eoincarrick7805 2 жыл бұрын
Please you should have focused on all 1:31,
@MilanDrazic
@MilanDrazic 3 жыл бұрын
I need this
@adamkenton2585
@adamkenton2585 3 жыл бұрын
How would you deploy this ?
@PortEXE
@PortEXE 3 жыл бұрын
Check out my beginner Next.js tutorial. The deployment process here would be the same as in that video.
@adamkenton2585
@adamkenton2585 3 жыл бұрын
@@PortEXE You mean "coding a news app..."
@PortEXE
@PortEXE 3 жыл бұрын
@@adamkenton2585 Yes. That one explains how to deploy a Next.js application. That same process can be applied here.
@adamkenton2585
@adamkenton2585 3 жыл бұрын
@@PortEXE Gotcha ! thank you so much
@akimayenasouleamidou6449
@akimayenasouleamidou6449 3 жыл бұрын
I can't post since the loading spinner keeps spinning forever 😔
@akimayenasouleamidou6449
@akimayenasouleamidou6449 3 жыл бұрын
I can't understand why that doesn't work. Any idea please?
@DarnellSylvain
@DarnellSylvain 3 жыл бұрын
My imagebuilder does nothing
@DarnellSylvain
@DarnellSylvain 3 жыл бұрын
when I console.log it it doesnt change at all when put through the builder
@ahnaafarafee
@ahnaafarafee 3 жыл бұрын
He just exposed his API key. Don't do it. Use .env files
@PortEXE
@PortEXE 3 жыл бұрын
I’ve got plenty of videos on that topic. Also I specifically mention not to expose it.
@muhammadmehdiali4172
@muhammadmehdiali4172 2 жыл бұрын
Instead of using the imageUrlBuilder method from @sanity/image-url, you can update your query to have it send you the url of the image directly. Since the image is actually a reference, you can have it point to the reference then send the url. This can be done through: const query = encodeURIComponent(`*[_type == "post" && slug.current == "${slug}"]{ "imageUrl": mainImage.asset->url, title, slug.... etc. }`) Now your post variable from the GET request contains post.imageUrl that is the url of the image.
@arremayu
@arremayu 3 жыл бұрын
Incase anyone getting error to add imgUrlBuilder then just pass it to url() function like this in useEffect hook::::--> setImageURL(imgBuilder.image(image).url());
@7taztoons
@7taztoons 2 жыл бұрын
Thanks , this comment need to be on top :) cc @PortEXE
@7taztoons
@7taztoons 2 жыл бұрын
if you have a problem with url img on the feed useEffect(() => { if (posts.length) { const imgBuilder = imageUrlBuilder({ projectId: "eb99jfco", dataset: "production", }) setMappedPosts( posts.map((post) => { return { ...post, mainImage: imgBuilder.image(post.mainImage).url(), } }) ) } else { setMappedPosts([]) } }, [posts])
@sjonny-depp
@sjonny-depp 3 жыл бұрын
3 things I notice is very weird 1. result.resut 2.DIV as a link and 3. passing INDEX as a key inside a map.. should never be a index value people should use a unique _ref ID.
Sanity Crash Course: Learn The Basics in 20 Minutes!
24:55
Build a blog using Contentful headless CMS and NextJs
1:23:43
Hamed Bahram
Рет қаралды 34 М.
She's very CREATIVE💡💦 #camping #survival #bushcraft #outdoors #lifehack
00:26
Сюрприз для Златы на день рождения
00:10
Victoria Portfolio
Рет қаралды 1,8 МЛН
Kluster Duo #настольныеигры #boardgames #игры #games #настолки #настольные_игры
00:47
Don't look down on anyone#devil  #lilith  #funny  #shorts
00:12
Devil Lilith
Рет қаралды 45 МЛН
Build a Next.js 14 Blog | React, Sanity.io, Tailwind.css, Shadcn/Ui
1:33:37
Beginner Next.js Tutorial - Coding A News App With Next.js
1:02:47
Everything I Do When I Start A New React Project
16:28
PortEXE
Рет қаралды 4,9 М.
Create your own Next.js Starter Template
2:35:29
Syntax
Рет қаралды 27 М.
Sanity.io Crash Course | Headless CMS
22:24
Traversy Media
Рет қаралды 139 М.
Build a Blog App in 1 hour - Code Along (NextJS 13)
58:07
Eincode
Рет қаралды 9 М.
Build and Deploy a Modern Full Stack ECommerce React Application with Stripe
3:34:12
React Tutorial - Build A Blog With GraphQL in 60 minutes
52:36
developedbyed
Рет қаралды 163 М.
She's very CREATIVE💡💦 #camping #survival #bushcraft #outdoors #lifehack
00:26