File tree Expand file tree Collapse file tree 2 files changed +64
-4
lines changed Expand file tree Collapse file tree 2 files changed +64
-4
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,9 @@ When the `value` of a `meta` object is an object, the `key: value` of the object
6969
7070In this case, the ` name ` and ` content ` properties will not be set by default.
7171
72- To set ` charset ` , for example:
72+ ### Charset tag
73+
74+ To generate ` charset ` tag, for example:
7375
7476``` ts title="rsbuild.config.ts"
7577export default {
@@ -89,6 +91,34 @@ The `meta` tag in HTML is:
8991<meta charset =" UTF-8" />
9092```
9193
94+ ### Open Graph tags
95+
96+ Generate [ Open Graph tags] ( https://ogp.me/ ) :
97+
98+ ``` ts title="rsbuild.config.ts"
99+ export default {
100+ html: {
101+ meta: {
102+ ' og:title' : {
103+ property: ' og:title' ,
104+ content: ' Example Title' ,
105+ },
106+ ' og:image' : {
107+ property: ' og:image' ,
108+ content: ' https://example.com/og.png' ,
109+ },
110+ },
111+ },
112+ };
113+ ```
114+
115+ The generated ` meta ` tags in the final HTML will look like:
116+
117+ ``` html
118+ <meta property =" og:title" content =" Example Title" />
119+ <meta property =" og:image" content =" https://example.com/og.png" />
120+ ```
121+
92122## Function usage
93123
94124- ** Type:**
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ export default {
4444};
4545```
4646
47- 最终在 HTML 中生成的 ` meta ` 标签为:
47+ 在 HTML 中生成的 ` meta ` 标签为:
4848
4949``` html
5050<meta name =" description" content =" a description of the page" />
@@ -67,7 +67,9 @@ type MetaOptions = {
6767
6868当 ` meta ` 对象的 ` value ` 为对象时,会将该对象的 ` key: value ` 映射为 ` meta ` 标签的属性。
6969
70- 比如设置 ` charset ` :
70+ ### charset 标签
71+
72+ 比如生成 ` charset ` 标签:
7173
7274``` ts title="rsbuild.config.ts"
7375export default {
@@ -81,12 +83,40 @@ export default {
8183};
8284```
8385
84- 最终在 HTML 中生成的 ` meta ` 标签为:
86+ 在 HTML 中生成的 ` meta ` 标签为:
8587
8688``` html
8789<meta charset =" UTF-8" />
8890```
8991
92+ ### Open Graph 标签
93+
94+ 生成 [ Open Graph 标签] ( https://ogp.me/ ) :
95+
96+ ``` ts title="rsbuild.config.ts"
97+ export default {
98+ html: {
99+ meta: {
100+ ' og:title' : {
101+ property: ' og:title' ,
102+ content: ' Example Title' ,
103+ },
104+ ' og:image' : {
105+ property: ' og:image' ,
106+ content: ' https://example.com/og.png' ,
107+ },
108+ },
109+ },
110+ };
111+ ```
112+
113+ 在 HTML 中生成的 ` meta ` 标签为:
114+
115+ ``` html
116+ <meta property =" og:title" content =" Example Title" />
117+ <meta property =" og:image" content =" https://example.com/og.png" />
118+ ```
119+
90120## 函数用法
91121
92122- ** 类型:**
You can’t perform that action at this time.
0 commit comments