From e4c60ab3c834fe7f730cd7b0d64dd23c6d04dbed Mon Sep 17 00:00:00 2001
From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
Date: Wed, 13 Jul 2022 23:47:27 +0530
Subject: [PATCH] fix: remove explicit noopener from external links (#871)
---
docs/guide/markdown.md | 2 +-
src/client/theme-default/components/VPButton.vue | 2 +-
src/client/theme-default/components/VPLink.vue | 2 +-
src/client/theme-default/components/VPSocialLink.vue | 2 +-
src/node/markdown/markdown.ts | 2 +-
src/node/markdownToVue.ts | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/docs/guide/markdown.md b/docs/guide/markdown.md
index 342904e5..11c60ff7 100644
--- a/docs/guide/markdown.md
+++ b/docs/guide/markdown.md
@@ -46,7 +46,7 @@ Pages and internal links get generated with the `.html` suffix by default.
### External Links
-Outbound links automatically get `target="_blank" rel="noopener noreferrer"`:
+Outbound links automatically get `target="_blank" rel="noreferrer"`:
- [vuejs.org](https://vuejs.org)
- [VitePress on GitHub](https://github.com/vuejs/vitepress)
diff --git a/src/client/theme-default/components/VPButton.vue b/src/client/theme-default/components/VPButton.vue
index 714f3e0c..12d0a44a 100644
--- a/src/client/theme-default/components/VPButton.vue
+++ b/src/client/theme-default/components/VPButton.vue
@@ -34,7 +34,7 @@ const component = computed(() => {
:class="classes"
:href="href ? normalizeLink(href) : undefined"
:target="isExternal ? '_blank' : undefined"
- :rel="isExternal ? 'noopener noreferrer' : undefined"
+ :rel="isExternal ? 'noreferrer' : undefined"
>
{{ text }}
diff --git a/src/client/theme-default/components/VPLink.vue b/src/client/theme-default/components/VPLink.vue
index 3984f811..1a28c273 100644
--- a/src/client/theme-default/components/VPLink.vue
+++ b/src/client/theme-default/components/VPLink.vue
@@ -19,7 +19,7 @@ const isExternal = computed(() => props.href && EXTERNAL_URL_RE.test(props.href)
:class="{ link: href }"
:href="href ? normalizeLink(href) : undefined"
:target="isExternal ? '_blank' : undefined"
- :rel="isExternal ? 'noopener noreferrer' : undefined"
+ :rel="isExternal ? 'noreferrer' : undefined"
>
diff --git a/src/client/theme-default/components/VPSocialLink.vue b/src/client/theme-default/components/VPSocialLink.vue
index 92d3fb12..53a6153c 100644
--- a/src/client/theme-default/components/VPSocialLink.vue
+++ b/src/client/theme-default/components/VPSocialLink.vue
@@ -32,7 +32,7 @@ const icons = {
:href="link"
:title="icon"
target="_blank"
- rel="noopener noreferrer"
+ rel="noreferrer"
>
{{ icon }}
diff --git a/src/node/markdown/markdown.ts b/src/node/markdown/markdown.ts
index 77276c62..7582f47f 100644
--- a/src/node/markdown/markdown.ts
+++ b/src/node/markdown/markdown.ts
@@ -78,7 +78,7 @@ export const createMarkdownRenderer = async (
linkPlugin,
{
target: '_blank',
- rel: 'noopener noreferrer',
+ rel: 'noreferrer',
...options.externalLinks
},
base
diff --git a/src/node/markdownToVue.ts b/src/node/markdownToVue.ts
index bc82adb5..9f050cd9 100644
--- a/src/node/markdownToVue.ts
+++ b/src/node/markdownToVue.ts
@@ -83,7 +83,7 @@ export async function createMarkdownToVueRenderFn(
`\n(!) Found dead link ${c.cyan(url)} in file ${c.white(
c.dim(file)
)}\nIf it is intended, you can use:\n ${c.cyan(
- `${url}`
+ `${url}`
)}`
)
)