[internal] Replace getInitialProps with getStaticProps#33684
[internal] Replace getInitialProps with getStaticProps#33684mnajdova merged 3 commits intomui:masterfrom
getInitialProps with getStaticProps#33684Conversation
getInitialProps with getStaticPropsgetInitialProps with getStaticProps
Janpot
left a comment
There was a problem hiding this comment.
A lot of these pages are almost duplicates, I wonder if they can be deduplicated using getStaticPaths and have them generated in the export phase instead of the compilation phase. I wonder whether it would speed up the build since less pages will have to be compiled.
|
I couldn't make this work in the past for all locales. So I would recommend also running export for all locales. |
|
Yep, using |
|
I tried it multiple times but never took the time writing down why. It all came down to vervel considering our use case exotic and not helping with guidance etc. It might work now and I would definitely recommend doing it long term. Just be sure to test how master would be deployed not just branches. And test /api and other routes separately. |
@mnajdova The point of Sebastian is confirmed. This PR broke the SEO structure when it comes to the translations. For example, the page https://mui.com/material-ui/api/table-pagination/ says: <link rel="alternate" href="https://mui.com/zh/material-ui/api/table-pagination/" hrefLang="zh"/>But this page is a 404 https://mui.com/zh/material-ui/api/table-pagination/. Chinese users will directly get a 404. The Google Search console started to raise flags about it (how I landed here). I could find a bit of documentation about it on Next.js's side: vercel/next.js#15315 (comment). What I would propose is to:
Otherwise:
|
|
I don't really have bandwidth to look into this more. I can revert the PR and delegate to someone else on the team to handle. |
@mnajdova Ok, sounds great. It will likely be for either:
|
getInitialProps with getStaticPropsgetInitialProps with getStaticProps
Related to #33196 (comment)
We still need
getInitialPropson the non-page files, like_document.js,_app.jsetc.