Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

239
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda