Skip to content

Commit 389c576

Browse files
committed
docs: support nav config for attr of external links
1 parent e88caf2 commit 389c576

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

packages/docs/docs/theme/default-theme-config.md

+15-2
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
@@ -346,7 +359,7 @@ module.exports = {
346359
```
347360

348361
::: warning Note
349-
Unlike the [built-in search](#built-in-search) engine which works out of the box, [Algolia DocSearch](https://community.algolia.com/docsearch/) requires you to submit your site to them for indexing before it starts working.
362+
Unlike the [built-in search](#built-in-search) engine which works out of the box, [Algolia DocSearch](https://community.algolia.com/docsearch/) requires you to submit your site to them for indexing before it starts working.
350363
:::
351364

352365
For more options, refer to [Algolia DocSearch's documentation](https://github.com/algolia/docsearch#docsearch-options).
@@ -460,7 +473,7 @@ This will render `.vuepress/components/SpecialLayout.vue` for the given page.
460473

461474
## Ejecting
462475

463-
You can copy the default theme source code into `.vuepress/theme` to fully customize the theme using the `vuepress eject [targetDir]` command.
476+
You can copy the default theme source code into `.vuepress/theme` to fully customize the theme using the `vuepress eject [targetDir]` command.
464477

465478
::: warning
466479
Once you eject, you are on your own and **won't** be receiving future updates or bug fixes to the default theme even if you upgrade VuePress.

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)