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.
In this article I will show you how to add the HTML lang attribute to your Next.js web application properly.
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:
You can learn more by following my social media:
Support my blog by this link: https://buymeacoffee.com/edx126
Posted by Edgar Hovhannisyan