SEO friendly URL with SSR-pages - how to? #171
-
Good afternoon. For example we have url to product page in next pages folder: Now this is an SSR page (we have a lot of products planned, and the process of creating / importing products will be a very voluminous task if you think about SSG). In the admin panel, we add a product, and among the product fields we made a QUESTION: What should we do so that, for example, the page Next.js has various options for doing something similar that we want. For example - for static sites with a small number of rarely added and updated pages, you can use the I also looked towards the What ideas do you have in this regard? I will be very grateful to you and grateful for any help in this direction. I am very disappointed that in Next.js it is difficult to understand how to make SEO friendly urls, although it would seem that this should be the primary task of the framework, which is designed to simplify SSR. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
@7iomka Why don't you just keep using SSG with revalidate (Incremental Static Regeneration) and fallback: true to generate a fallback page (with a loading) while the page is being build up. That would improve the user experience of your site quite a lot specially because with SSG pages and assets (JS, CSS, images, fonts, etc) will automatically be served from the Vercel's Edge Network, which is blazingly fast. You have way more benefits:
And if you still need to fetch more dynamic data you can always use client side fetching. Just my 2 cents. |
Beta Was this translation helpful? Give feedback.
-
@samuelcastro |
Beta Was this translation helpful? Give feedback.
-
@GTOsss SSG with fallback allows you to build "on-the-fly" pages, coupled with "catch-all" page pattern, it can be used to build pages based on any number of inputs. But, SSG/SSR isn't really the question at this point. Both can be used as @samuelcastro mentioned. I'd personally go for SSG with revalidate, so that the previously built page is used while the new version is getting built. It's indeed faster (better SEO score) and even if your product changes on the admin panel, it'd update the page at the next page generation. But, in the end you can use either, it's just a matter of choices and constraints. (does the page MUST be always sync in real time? Or, can it wait a bit? (30sec, 5mn, depending on your revalidation strategy) That is what you must ask yourself regarding the SSG/SSR choice/dilemna. @7iomka Regarding the initial issue, there is an official RFC about this that is going on, I suggest you take a look at it and see if it would help your use-case. vercel/next.js#17078 But, the RFC isn't implemented yet, and in the meantime you'll need to resort to a homemade solution. I'd personally go for "catch-all" routes. See https://nextjs.org/docs/routing/dynamic-routes "/:locale/[...slug].js" would match I believe it could be possible to either build your own "mapping" where "/iphones/iphone-11" redirects to "/:locale/catalog/product/iphone-11" page, for instance. Or, you could also serve the page without any redirection. This needs a bit of experimentation, but I don't see anything that would make it impossible. Also, I'll convert this "issue" into a discussion, as it's not a real NRN issue but more of a question 😉 |
Beta Was this translation helpful? Give feedback.
@GTOsss SSG with fallback allows you to build "on-the-fly" pages, coupled with "catch-all" page pattern, it can be used to build pages based on any number of inputs.
But, SSG/SSR isn't really the question at this point. Both can be used as @samuelcastro mentioned. I'd personally go for SSG with revalidate, so that the previously built page is used while the new version is getting built. It's indeed faster (better SEO score) and even if your product changes on the admin panel, it'd update the page at the next page generation. But, in the end you can use either, it's just a matter of choices and constraints. (does the …