I have a blog page with posts stored in database. I allow users to suggest changes to post and comment it. The path is /app/posts/[name]/page.tsx. Should I use static rendering (https://nextjs.org/learn/dashboard-app/static-and-dynamic-rendering)? I read that it should improve seo a lot. I would appreciate help.
>Solution :
There are many pros and cons to use static site generation of next js:
Pros
- Helps in SEO: Search Engine Optimization helps your website rank higher on search engines like Google.
- In your Next.js application, search engines can easily crawl SSG-indexed pages because they are just HTML files.
- SSG works better with Content Delivery Networks (CDNs), which means you can serve your static page from distributed servers worldwide, which improves your website’s global performance.
- Since the web pages are pre-generated, the server is not expected to process each request sent by a user, which improves your website’s scalability.
Cons
- With SSG, you cannot effectively change or make real-time updates on your website because any update will require a rebuild, causing delays.
- The build process can become time-consuming on websites with numerous pages.
- If your Next.js applications require authentication and logic, it can be challenging to use SSG.
As a next js developer myself, I’d recommend using ssg for any data that doesn’t need an update on every client view and even If it needs an update, use revalidate option.
And for any data that gets updated alot and the client should always get the latest version, I’d recommend using ssr coupled with react’s own client side rendering.