Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

248
Visualizações
How to set HTML lang attribute for a specific page in Next.js?

I have a Next.js website with multiple pages.

All pages are in English except one which is in French which doesn't have an English version of it.

How can I set the HTML tag lang attribute on that specific page?

This is not something I could achieve using next/head or with a custom document.

My _document.js class currently looks like this, so that English is the default for all pages:

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

export default function Document() {
  return (
    <Html lang="en">
      <Head />
      <body>
        <Main />
        <NextScript />
      </body>
    </Html>
  )
}

What I would need is to dynamically set the lang attribute value to fr for one specific page.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I think for this, one the easiest solution could be layouts.

You can read more about here

https://nextjs.org/docs/basic-features/layouts

And add Next custom Tags

https://nextjs.org/docs/advanced-features/custom-document

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda