Haroun Ach
Haroun Ach

Reputation: 23

next.js _document.js didn't get called

I have a small problem with next.js _document.js. I want to support Arabic, so, I add lang="ar" to Html component. But, in the page rendered there is no lang attribute in HTML. Hope somebody help me.

Upvotes: 2

Views: 812

Answers (1)

Sean W
Sean W

Reputation: 6598

In order for Next.js to show updates made in _document you must stop and restart Next.js.

You must restart Next.js after making changes in _document, *.env, or any Next.js config files.


pages/_document.{ jsx | tsx }

import NextDocument, { Head, Html, Main, NextScript } from 'next/document';

class Document extends NextDocument {
  render = () => (
    <Html lang="ar" dir="rtl">
      <Head />
      <body>
        <Main />
        <NextScript />
      </body>
    </Html>
  );
}

export default Document;

Upvotes: 2

Related Questions