0

I would like to know if the output generated by nextjs SSG build is SEO friendly, the same way as using nextjs with SSR.

The reason I am asking is, because I would like to build a full stack app with React frontend (Django/DRF backend for what is worth), and SEO is really important. Also I would prefer to not have a separate nodejs instance serving the frontend separately.

tl:dr I would like to serve only static files for the frontend while also being SEO friendly.

Thanks very much in advance.

  • Both SSR and SSG generate the page on the server and send it to the client. The only difference is that SSR does it every time on each request to the page, while SSG does it only once when the app is built. – juliomalves Jul 24 '22 at 07:15

1 Answers1

0

NextJS provides you options for Server Side Rendering and Static Site Generation, to implement SSG, you need to configure your pages to render SSG pages . The build has the data pre-loaded but I am not sure if this is the intended application of your full-stack application. Usually Next(and/or any other front-end framework) does server side rendering when coupled with a back-end like Django. So if you're sure about rendering static files, then yes. NextJS is search engine friendly. You should also consider React Helmet which provides great options for SEO in react.

  • ok so if I generate a static files build with some client data fetching inside (vanilla js fetch/axios) there wouldn't be any problem regarding SEO right? assuming most of the page is static content and I need data fetching for a small portion – Thanasis Xanthopoulos Jul 22 '22 at 22:30
  • Yes that should solve the problem if it's small data. But remember your data will remain in the state when it's fetched. If you're fetching it now and expecting it to change, even if the server changes it, the page won't change. Also for cases like this you should consider [GatsbyJS](https://gtsb.io) – Abhijith Ganesh Jul 22 '22 at 22:32