fully server side only multilingual custom not-found page
Unanswered
HaykMkrtich posted this in #help-forum
Hi there for my site I need a not-found page to be multilingual. The whole site is multilingual by using next-intl.
Here are all my requirements to have the page 404:
The page should be multilingual. For example if a user tries to open invalid page on a non default language "/ru/blog/invalid-slug" then the 404 page should be in Russian. But not-found.tsx doesn't accept any parameters.
The page should have a meta title and description.
The page should be server side fetching of page content should be only in the server. Users should see an already generated version of the 404 page.
Page should be with status 404.
The Page's content should not be added in the source code of other pages. This happens because now my page fetches data on the server and passes it to the client component which gets locale by useLocale(). And as we know if some data is passing to the client component it adds to page source code with next.self.push. If on the server I could get the locale parameter all these chain of problems I can solve.
Are there any ideas how I can achieve that?.
Here are all my requirements to have the page 404:
The page should be multilingual. For example if a user tries to open invalid page on a non default language "/ru/blog/invalid-slug" then the 404 page should be in Russian. But not-found.tsx doesn't accept any parameters.
The page should have a meta title and description.
The page should be server side fetching of page content should be only in the server. Users should see an already generated version of the 404 page.
Page should be with status 404.
The Page's content should not be added in the source code of other pages. This happens because now my page fetches data on the server and passes it to the client component which gets locale by useLocale(). And as we know if some data is passing to the client component it adds to page source code with next.self.push. If on the server I could get the locale parameter all these chain of problems I can solve.
Are there any ideas how I can achieve that?.