From 6b8799ca9778542bfa7ef2b3526872f2df7355ef Mon Sep 17 00:00:00 2001 From: Alex Bea Date: Thu, 23 Apr 2020 11:43:17 -0500 Subject: [PATCH 1/5] fix: allows no rel attribute on external links in the nav --- packages/@vuepress/theme-default/components/NavLink.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/@vuepress/theme-default/components/NavLink.vue b/packages/@vuepress/theme-default/components/NavLink.vue index 4ccd13d88b..d35ff118f8 100644 --- a/packages/@vuepress/theme-default/components/NavLink.vue +++ b/packages/@vuepress/theme-default/components/NavLink.vue @@ -71,10 +71,13 @@ export default { if (this.isNonHttpURI) { return null } + if (!this.item.rel && this.item.rel !== undefined) { + return null + } if (this.item.rel) { return this.item.rel } - return this.isBlankTarget ? 'noopener noreferrer' : '' + return this.isBlankTarget ? 'noopener noreferrer' : null } }, From 9bfd83c07261937a13f92945edd67846ae868199 Mon Sep 17 00:00:00 2001 From: Alex Bea Date: Thu, 23 Apr 2020 11:50:20 -0500 Subject: [PATCH 2/5] fix: documents the falsy rel option --- packages/docs/docs/theme/default-theme-config.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/docs/docs/theme/default-theme-config.md b/packages/docs/docs/theme/default-theme-config.md index 03b5ef7734..ec99f35c20 100644 --- a/packages/docs/docs/theme/default-theme-config.md +++ b/packages/docs/docs/theme/default-theme-config.md @@ -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. Passing a "falsy" value to the `rel` attribute will disable that 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' } ] } @@ -353,7 +353,7 @@ You can improve the search result by [setting `tags` in frontmatter](../guide/fr ```yaml --- -tags: +tags: - configuration - theme - indexing From 833a829a8966826bb2e4c0a0df0694717c13f145 Mon Sep 17 00:00:00 2001 From: Alex Bea Date: Sat, 2 May 2020 05:57:55 -0500 Subject: [PATCH 3/5] fix: clarifies documentation --- packages/docs/docs/theme/default-theme-config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docs/docs/theme/default-theme-config.md b/packages/docs/docs/theme/default-theme-config.md index ec99f35c20..562e2cdd3d 100644 --- a/packages/docs/docs/theme/default-theme-config.md +++ b/packages/docs/docs/theme/default-theme-config.md @@ -69,7 +69,7 @@ module.exports = { } ``` -Outbound links automatically get `target="_blank" rel="noopener noreferrer"`. You can offer `target` and `rel` to customize the attributes. Passing a "falsy" value to the `rel` attribute will disable that attribute for a link: +Outbound links automatically get `target="_blank" rel="noopener noreferrer"`. You can offer `target` and `rel` to customize the attributes. Passing a "falsy" value (that is _not_ `undefined`) to the `rel` attribute will disable that attribute for a link: ``` js // .vuepress/config.js From e43eb5d0c517aece2a81e6f3d621e03c7846c047 Mon Sep 17 00:00:00 2001 From: Alex Bea Date: Mon, 4 May 2020 08:55:06 -0500 Subject: [PATCH 4/5] fix: explicitly uses for rel attr --- packages/@vuepress/theme-default/components/NavLink.vue | 2 +- packages/docs/docs/theme/default-theme-config.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@vuepress/theme-default/components/NavLink.vue b/packages/@vuepress/theme-default/components/NavLink.vue index d35ff118f8..2d1296a0fa 100644 --- a/packages/@vuepress/theme-default/components/NavLink.vue +++ b/packages/@vuepress/theme-default/components/NavLink.vue @@ -71,7 +71,7 @@ export default { if (this.isNonHttpURI) { return null } - if (!this.item.rel && this.item.rel !== undefined) { + if (!this.item.rel && this.item.rel === false) { return null } if (this.item.rel) { diff --git a/packages/docs/docs/theme/default-theme-config.md b/packages/docs/docs/theme/default-theme-config.md index 562e2cdd3d..4185e0cd49 100644 --- a/packages/docs/docs/theme/default-theme-config.md +++ b/packages/docs/docs/theme/default-theme-config.md @@ -69,7 +69,7 @@ module.exports = { } ``` -Outbound links automatically get `target="_blank" rel="noopener noreferrer"`. You can offer `target` and `rel` to customize the attributes. Passing a "falsy" value (that is _not_ `undefined`) to the `rel` attribute will disable that attribute for a link: +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 From 41d07e6f525abc151f20f63410f8363dd4efa6bf Mon Sep 17 00:00:00 2001 From: Alex Bea Date: Mon, 4 May 2020 12:37:19 -0500 Subject: [PATCH 5/5] fix: removes unnecessary condition Co-authored-by: Billyyyyy3320 --- packages/@vuepress/theme-default/components/NavLink.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@vuepress/theme-default/components/NavLink.vue b/packages/@vuepress/theme-default/components/NavLink.vue index 2d1296a0fa..f7e65a4451 100644 --- a/packages/@vuepress/theme-default/components/NavLink.vue +++ b/packages/@vuepress/theme-default/components/NavLink.vue @@ -71,7 +71,7 @@ export default { if (this.isNonHttpURI) { return null } - if (!this.item.rel && this.item.rel === false) { + if (this.item.rel === false) { return null } if (this.item.rel) {