Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Should blog post with comments be a static page NextJS

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 :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading