html.meta

TIP

该配置由 Modern.js Builder 提供,更多信息可参考 html.meta

  • 类型: Record<string, false | string | Record<string, string | boolean>>
  • 默认值: undefined

配置 HTML 页面的 <meta> 标签。

String 类型

meta 对象的 value 为字符串时,会自动将对象的 key 映射为 namevalue 映射为 content

比如设置 description

export default {
  html: {
    meta: {
      description: 'a description of the page',
    },
  },
};

最终在 HTML 中生成的 meta 标签为:

<meta name="description" content="a description of the page" />

Object 类型

meta 对象的 value 为对象时,会将该对象的 key: value 映射为 meta 标签的属性。

这种情况下默认不会设置 namecontent 属性。

比如设置 http-equiv

export default {
  html: {
    meta: {
      'http-equiv': {
        'http-equiv': 'x-ua-compatible',
        content: 'ie=edge',
      },
    },
  },
};

最终在 HTML 中生成的 meta 标签为:

<meta http-equiv="x-ua-compatible" content="ie=edge" />

移除默认值

meta 对象的 value 设置为 false,则表示不生成对应的 meta 标签。

比如移除框架预设的 imagemode

export default {
  html: {
    meta: {
      imagemode: false,
    },
  },
};