Tuesday 9th April, 2024
For SEO purposes it’s better to have the <html lang=”en”> attribute in your Next.js web app. But adding just manually to your code will cause issues.
Since Next.js is a React framework, it does not work the same way because there is no HTML file to edit, when you first create the next application with the command npx create-next-app
it doesn’t automatically set the lang attribute to English.
To do at properly, you have to add the following:
i18n: {locales: [“en”], defaultLocale: “en”, },
to your next.config.js file for implementing <html lang=”en”>
After saving, and redeploying the changes, you will see the result in the console:
Posted by Edgar Hovhannisyan