diff --git a/packages/docs/docs/theme/default-theme-config.md b/packages/docs/docs/theme/default-theme-config.md index 1ff8374739..8228bd6a5c 100644 --- a/packages/docs/docs/theme/default-theme-config.md +++ b/packages/docs/docs/theme/default-theme-config.md @@ -54,6 +54,19 @@ module.exports = { } ``` +Outbound links automatically get `target="_blank" rel="noopener noreferrer"`. You can offer `target` and `rel` to customize the attributes: + +``` js +// .vuepress/config.js +module.exports = { + themeConfig: { + nav: [ + { text: 'External', link: 'https://google.com', target:'_self', rel:'' }, + ] + } +} +``` + These links can also be dropdown menus if you provide an array of `items` instead of a `link`: ```js @@ -346,7 +359,7 @@ module.exports = { ``` ::: warning Note -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. +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. ::: 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. ## Ejecting -You can copy the default theme source code into `.vuepress/theme` to fully customize the theme using the `vuepress eject [targetDir]` command. +You can copy the default theme source code into `.vuepress/theme` to fully customize the theme using the `vuepress eject [targetDir]` command. ::: warning 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. diff --git a/packages/docs/docs/zh/theme/default-theme-config.md b/packages/docs/docs/zh/theme/default-theme-config.md index 843079e01d..d2f15853e7 100644 --- a/packages/docs/docs/zh/theme/default-theme-config.md +++ b/packages/docs/docs/zh/theme/default-theme-config.md @@ -48,6 +48,20 @@ module.exports = { ] } } + + +``` +外部链接 `` 标签的特性将默认包含`target="_blank" rel="noopener noreferrer"`,你可以提供 `target` 与 `rel`,它们将被作为特性被增加到 `` 标签上: + +``` js +// .vuepress/config.js +module.exports = { + themeConfig: { + nav: [ + { text: 'External', link: 'https://google.com', target:'_self', rel:'' }, + ] + } +} ``` 当你提供了一个 `items` 数组而不是一个单一的 `link` 时,它将显示为一个 `下拉列表` :