Set lang attribute at build time #16797
byte-artisan
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Just had to find a way to do it. import React, { useEffect } from 'react'
// ...
const MyApp = ({ Component, pageProps }) => {
useEffect(() => {
document.documentElement.lang = pageProps.lang;
});
return <Component {...pageProps} />;
};
export default MyApp; HTH |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Feature request
Allow to setup different lang attribute values to different pages, at build time
Currently it set on document and so is the same for all pages.
Is your feature request related to a problem? Please describe.
Indicate the language for the page is important for SEO. Chrome lighthouse report the lack of it.
I can't set it up using client code but that is not the best away for all crawlers and it can't be done for amp pages.
Describe the solution you'd like
Be able declare it in each page. If declared on the page should override the value defined at the document level.
The logical place to place this functionality should be the meta module.
Beta Was this translation helpful? Give feedback.
All reactions