How to declare language in Gatsby
For multi-language web page, it's important to tell browser and search engineer what language is for the web page content.
HTML uses lang
attribute(lang - MDN Web Docs) to define language.
<html lang="zh-CN"></html>
The value of lang
is defined at RFC 5646(aka BCP 47)
To modify html attribute, we need the React Helmet plugin.
<Helmet
htmlAttributes={{
lang: 'zh-CN',
}}
/>