New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core] Replace getInitialProps
with getStaticProps
#33684
[core] Replace getInitialProps
with getStaticProps
#33684
Conversation
getInitialProps
with getStaticProps
getInitialProps
with getStaticProps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
|
Related to #33196 (comment)
We still need
getInitialProps
on the non-page files, like_document.js
,_app.js
etc.