next-export-lang
v1.0.1
Published
A npm package to add the HTML lang attribute to all export files after building for SEO
Downloads
2
Maintainers
Readme
Next Export Lang
A simple npm package to add the HTML lang attribute to all export files after building to satisfy the Lighthouse accessibility rule for SEO.
Installation and Usage
Global CLI Usage
- Run
npm install -g next-export-lang
- Example: run
next-export-lang en-US
when in a Next.JS project after running thenext export
command to add HTML 'lang' attributes to all HTML files in the 'out' folder.
Local Project Installation
The next-export-lang package can be installed in a Node project so it can be integrated as part of your build process.
- Run
npm install -D next-export-lang
- Add
next-export-lang
to your build command (afternext export
). For example, in your package.json, update your build script, adding&& next-export-lang en
to the end, replacing 'en' with the language you want to add to your HTML files:"build": "next export && next-export-lang"
.
A lang attribute with the defined language will be added to all HTML files in the 'out' folder generated from the next export
command.