Skip to content

Commit b343cd3

Browse files
abeabillyyyyy3320
andauthoredJul 23, 2020
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: Billyyyyy3320 <newsbielt703@gmail.com> Co-authored-by: Billyyyyy3320 <newsbielt703@gmail.com>
1 parent 18b2198 commit b343cd3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed
 

‎packages/@vuepress/theme-default/components/NavLink.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,13 @@ export default {
7171
if (this.isNonHttpURI) {
7272
return null
7373
}
74+
if (this.item.rel === false) {
75+
return null
76+
}
7477
if (this.item.rel) {
7578
return this.item.rel
7679
}
77-
return this.isBlankTarget ? 'noopener noreferrer' : ''
80+
return this.isBlankTarget ? 'noopener noreferrer' : null
7881
}
7982
},
8083

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ module.exports = {
6969
}
7070
```
7171

72-
Outbound links automatically get `target="_blank" rel="noopener noreferrer"`. You can offer `target` and `rel` to customize the attributes:
72+
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:
7373

7474
``` js
7575
// .vuepress/config.js
7676
module.exports = {
7777
themeConfig: {
7878
nav: [
79-
{ text: 'External', link: 'https://google.com', target:'_self', rel:'' },
79+
{ text: 'External', link: 'https://google.com', target:'_self', rel:false },
8080
{ text: 'Guide', link: '/guide/', target:'_blank' }
8181
]
8282
}
@@ -355,7 +355,7 @@ You can improve the search result by [setting `tags` in frontmatter](../guide/fr
355355

356356
```yaml
357357
---
358-
tags:
358+
tags:
359359
- configuration
360360
- theme
361361
- indexing

0 commit comments

Comments
 (0)
Please sign in to comment.