Unverified Commit 22800319 authored by John Doe's avatar John Doe Committed by GitHub

Create _document.js to include current language in HTML tag (#16360)

* Create _document.js

 Includes the lang attribute with current language inside the <html> tag.

* Lint fix
Co-authored-by: 's avatarLuis Alvarez D <luis@vercel.com>
Co-authored-by: 's avatarkodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
parent fa153bcf
import Document, { Html, Head, Main, NextScript } from 'next/document'
class MyDocument extends Document {
static async getInitialProps(ctx) {
const initialProps = await Document.getInitialProps(ctx)
return { ...initialProps, lang: ctx.query.lng }
}
render() {
return (
<Html lang={this.props.lang}>
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
)
}
}
export default MyDocument
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment