【问题标题】:Proper way to add the language tag in Next/Head在 Next/Head 中添加语言标签的正确方法
【发布时间】:2021-12-05 18:38:49
【问题描述】:

我找不到将语言标签与 Next Head 一起使用的可靠示例。这是我见过的最好的两个。如果有的话,哪一个是合适的?

注意:它不必是动态的。

选项 1

<Head>
  <meta property="og:locale" content="en_US" />
  ...
</Head>

选项 2

<html lang='en'>
  <Head>
  ...
  </Head>
</html>

选项 3(大写 Html)

<Html lang='en'>
  <Head>
  ...
  </Head>
</Html>

【问题讨论】:

标签: html next.js head


【解决方案1】:

你可以将它添加到next.config.js中

module.exports = {
  i18n: {
    locales: ['en-US'],
    defaultLocale: 'en-US',
    localeDetection: false,
  },
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-31
    • 2021-11-20
    相关资源
    最近更新 更多