Using a single catch-all route for CMS pages #13715
Unanswered
JonCognioDigital
asked this question in
Help
Replies: 1 comment
-
Hi, let me try answering:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I've built a couple of Next sites in the past, always using SSR with a my CMS and always defining all routes in the pages directory because all pages were known at build time they just needed to fetch their content.
Now that we have catch-all routes and SSG I'm trying to work out how it all fits together, which leads to a few questions....
I'm assuming that I can place any known routes which don't behave this way like the search/results in the pages directory and they'll behave differently, the catch-all just catches anything else?
Because the CMS might have hundreds of pages and they are not known at build time, can I use an empty "getStaticPaths" with fallback:true. As I understand it the user will see a loading indicator at first then it will be repalced by the content?
If that is the case then how does that work with SEO. Do we have to assume that Googlebot isn't the first visitor after a new page is created otherwise it'll just get a loading indicator served by the server?
How long are pages cached when using fallback:true and for how long? If we assume that the content editor always views the page at least once after creating it can we always assume that if Googlebot comes along later it will get a full page not a loading indicator?
Lastly, what about 404s and 301s? Assuming we use the catch-all routes then the browser will always get a 200 response while it tries to load the content presumably, if the content isn't in the CMS or it has moved then it should have got a 404 or 301 as the server response?
Sorry for all the questions but I've been reading the docs for nearly 24 hours trying to work out a strategy. If I can't get it all working then I could revert to just a normal SSR app but that would be a shame given all the progress on SSG by the Next JS team.
Many Thanks.
Beta Was this translation helpful? Give feedback.
All reactions