diff --git a/website/docs/en/config/html/meta.mdx b/website/docs/en/config/html/meta.mdx index 614dbef5d6..19869760a5 100644 --- a/website/docs/en/config/html/meta.mdx +++ b/website/docs/en/config/html/meta.mdx @@ -69,7 +69,9 @@ When the `value` of a `meta` object is an object, the `key: value` of the object In this case, the `name` and `content` properties will not be set by default. -To set `charset`, for example: +### Charset tag + +To generate `charset` tag, for example: ```ts title="rsbuild.config.ts" export default { @@ -89,6 +91,34 @@ The `meta` tag in HTML is: ``` +### Open Graph tags + +Generate [Open Graph tags](https://ogp.me/): + +```ts title="rsbuild.config.ts" +export default { + html: { + meta: { + 'og:title': { + property: 'og:title', + content: 'Example Title', + }, + 'og:image': { + property: 'og:image', + content: 'https://example.com/og.png', + }, + }, + }, +}; +``` + +The generated `meta` tags in the final HTML will look like: + +```html + + +``` + ## Function usage - **Type:** diff --git a/website/docs/zh/config/html/meta.mdx b/website/docs/zh/config/html/meta.mdx index ec03ae09c2..7ab876cf8b 100644 --- a/website/docs/zh/config/html/meta.mdx +++ b/website/docs/zh/config/html/meta.mdx @@ -44,7 +44,7 @@ export default { }; ``` -最终在 HTML 中生成的 `meta` 标签为: +在 HTML 中生成的 `meta` 标签为: ```html @@ -67,7 +67,9 @@ type MetaOptions = { 当 `meta` 对象的 `value` 为对象时,会将该对象的 `key: value` 映射为 `meta` 标签的属性。 -比如设置 `charset`: +### charset 标签 + +比如生成 `charset` 标签: ```ts title="rsbuild.config.ts" export default { @@ -81,12 +83,40 @@ export default { }; ``` -最终在 HTML 中生成的 `meta` 标签为: +在 HTML 中生成的 `meta` 标签为: ```html ``` +### Open Graph 标签 + +生成 [Open Graph 标签](https://ogp.me/): + +```ts title="rsbuild.config.ts" +export default { + html: { + meta: { + 'og:title': { + property: 'og:title', + content: 'Example Title', + }, + 'og:image': { + property: 'og:image', + content: 'https://example.com/og.png', + }, + }, + }, +}; +``` + +在 HTML 中生成的 `meta` 标签为: + +```html + + +``` + ## 函数用法 - **类型:**