未验证 提交 b343cd3c 编写于 作者: A Alex Bea 提交者: GitHub

fix: allows no rel attribute on external links in the nav (#2338)

* fix: allows no rel attribute on external links in the nav

* fix: documents the falsy rel option

* fix: clarifies documentation

* fix: explicitly uses  for rel attr

* fix: removes unnecessary condition
Co-authored-by: NBillyyyyy3320 <newsbielt703@gmail.com>
Co-authored-by: NBillyyyyy3320 <newsbielt703@gmail.com>
上级 18b21988
......@@ -71,10 +71,13 @@ export default {
if (this.isNonHttpURI) {
return null
}
if (this.item.rel === false) {
return null
}
if (this.item.rel) {
return this.item.rel
}
return this.isBlankTarget ? 'noopener noreferrer' : ''
return this.isBlankTarget ? 'noopener noreferrer' : null
}
},
......
......@@ -69,14 +69,14 @@ module.exports = {
}
```
Outbound links automatically get `target="_blank" rel="noopener noreferrer"`. You can offer `target` and `rel` to customize the attributes:
Outbound links automatically get `target="_blank" rel="noopener noreferrer"`. You can offer `target` and `rel` to customize the attributes. Setting `rel: false` as will disable the `rel` attribute for a link:
``` js
// .vuepress/config.js
module.exports = {
themeConfig: {
nav: [
{ text: 'External', link: 'https://google.com', target:'_self', rel:'' },
{ text: 'External', link: 'https://google.com', target:'_self', rel:false },
{ text: 'Guide', link: '/guide/', target:'_blank' }
]
}
......@@ -355,7 +355,7 @@ You can improve the search result by [setting `tags` in frontmatter](../guide/fr
```yaml
---
tags:
tags:
- configuration
- theme
- indexing
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册