Skip to content

Commit e8f91f8

Browse files
committed
docs: support nav config for attr of external links
1 parent 2680b5a commit e8f91f8

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

Diff for: packages/docs/docs/theme/default-theme-config.md

+13
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ module.exports = {
5454
}
5555
```
5656

57+
Outbound links automatically get `target="_blank" rel="noopener noreferrer"`. You can offer `target` and `rel` to customize the attributes:
58+
59+
``` js
60+
// .vuepress/config.js
61+
module.exports = {
62+
themeConfig: {
63+
nav: [
64+
{ text: 'External', link: 'https://google.com', target:'_self', rel:'' },
65+
]
66+
}
67+
}
68+
```
69+
5770
These links can also be dropdown menus if you provide an array of `items` instead of a `link`:
5871

5972
```js

Diff for: packages/docs/docs/zh/theme/default-theme-config.md

+14
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,20 @@ module.exports = {
4848
]
4949
}
5050
}
51+
52+
53+
```
54+
外部链接 `<a>` 标签的特性将默认包含`target="_blank" rel="noopener noreferrer"`,你可以提供 `target``rel`,它们将被作为特性被增加到 `<a>` 标签上:
55+
56+
``` js
57+
// .vuepress/config.js
58+
module.exports = {
59+
themeConfig: {
60+
nav: [
61+
{ text: 'External', link: 'https://google.com', target:'_self', rel:'' },
62+
]
63+
}
64+
}
5165
```
5266

5367
当你提供了一个 `items` 数组而不是一个单一的 `link` 时,它将显示为一个 `下拉列表`

0 commit comments

Comments
 (0)