Wow, you're a huge help. Will be tuning in for all your Next.js videos. You're a great resource with so many devs currently switching/moving over to Next.
@@colbyfayock One quick thing---sorry for the bother. Something I am trying to solve that maybe you've seen before: programmatically including all the valid folders/routes in my Next.js app in my sitemap. (I am using v14 / the app router) I am trying to find some function that does this, but can't seem to find it. For example, I have an "about" folder/page and a "contact" folder/page. I'd rather not manually type these into the sitemap. Is there a way for Next.js v14 to get all of these routes to include when generating the sitemap? Thank you a ton.
@@patricksweet4104haven't seen an example but you could potentially see if it would allow you to scan the filesystem and list out the directories, but it wouldn't be a blanket solution for every use case
I am curious / unsure though---will file system scans work once it is deployed? Just wondering since it is technically the post-build version that would run that js to generate the sitemap.
Big thanks dude. I've been trying to implement this feature for the last two days and was not able to get it to work until I found this video. You just got a subscriber!
I have a question, if my website has too large data (ex: Film website), and I have pagination (20 films/page). How should I write dynamic sitemap for it? Because if I get all films, I think it's a lot of time
Thanks for this valuable guide, Can you tell me how can I revalidate my sitemap.js? I have used fetch with next js revalidate in it but it doesn't revalidate it when a new page is added.
you're welcome! i would think it would only revalidate once the cache headers expire, not new content. i havent tried this with a route handler, but have you looked at on-demand revalidation? nextjs.org/docs/app/building-your-application/data-fetching/revalidating#on-demand-revalidation
there's not quite yet a native way ot do that, but its on their list: > In the future, we will support multiple sitemaps and sitemap indexes. in the meantime youd likely need to manually create a route, kind of like we're doing with the RSS Feed, and create your own links to the other sitemaps based on your own rules for what data goes in which sitemap
Learn how to build a full stack Next.js app in my upcoming course: colbyfayock.com/course
Wow, you're a huge help. Will be tuning in for all your Next.js videos. You're a great resource with so many devs currently switching/moving over to Next.
thanks! glad it helped
@@colbyfayock One quick thing---sorry for the bother.
Something I am trying to solve that maybe you've seen before: programmatically including all the valid folders/routes in my Next.js app in my sitemap. (I am using v14 / the app router)
I am trying to find some function that does this, but can't seem to find it.
For example, I have an "about" folder/page and a "contact" folder/page. I'd rather not manually type these into the sitemap. Is there a way for Next.js v14 to get all of these routes to include when generating the sitemap?
Thank you a ton.
@@patricksweet4104haven't seen an example but you could potentially see if it would allow you to scan the filesystem and list out the directories, but it wouldn't be a blanket solution for every use case
@@colbyfayock yep that is what I'm doing currently. Should do what I need for now. Thank you!
I am curious / unsure though---will file system scans work once it is deployed? Just wondering since it is technically the post-build version that would run that js to generate the sitemap.
Big thanks dude. I've been trying to implement this feature for the last two days and was not able to get it to work until I found this video. You just got a subscriber!
awesome, no problem!
This helped me a lot when building my new blogsite using NextJS. Thanks for that man I hope you get more attention
no problem, thank you!
Criminally underrated
appreciate that!
I have a question, if my website has too large data (ex: Film website), and I have pagination (20 films/page). How should I write dynamic sitemap for it? Because if I get all films, I think it's a lot of time
Great Colby, Thanks for sharing !
no problem!
Get fresh tutorials and other free content straight to your inbox! colbyfayock.com/news
tnx for it, how can create sitemapindex in next and rss
np! check this out: nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap#generating-multiple-sitemaps
thanks for this , I need it.
🙌
Thanks for this valuable guide, Can you tell me how can I revalidate my sitemap.js? I have used fetch with next js revalidate in it but it doesn't revalidate it when a new page is added.
you're welcome! i would think it would only revalidate once the cache headers expire, not new content. i havent tried this with a route handler, but have you looked at on-demand revalidation? nextjs.org/docs/app/building-your-application/data-fetching/revalidating#on-demand-revalidation
is there any method to make nested dynamic sitemap i've more than 50k+ data
there's not quite yet a native way ot do that, but its on their list:
> In the future, we will support multiple sitemaps and sitemap indexes.
in the meantime youd likely need to manually create a route, kind of like we're doing with the RSS Feed, and create your own links to the other sitemaps based on your own rules for what data goes in which sitemap
Thank you very much
no problem!
Great tut
thank you!