olivierr91
olivierr91

Reputation: 1425

Proper way to display different header information according to the current page in Next.js

I need to display a Language switch button in the top navigation bar of my site (rendered inside a Layout). Obviously, the switching URL depends of the current page.

Considering the following "design" limitations of Next.js App v13+ router:

What is the proper way of doing this?

The only workaround I have found is to inject the pathname in the headers using the middleware and force dynamic page generation.

Upvotes: 0

Views: 307

Answers (1)

Serhii Mamedov
Serhii Mamedov

Reputation: 1343

Next.js has a nice doc on internationalization with app router. It has examples with how to use it with server components and static generation. Also there is a reference on i18n integration.

Upvotes: 0

Related Questions