Skip to content

fix: remove explicit noopener from external links #871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/guide/markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/client/theme-default/components/VPButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const component = computed(() => {
:class="classes"
:href="href ? withBase(href) : undefined"
:target="isExternal ? '_blank' : undefined"
:rel="isExternal ? 'noopener noreferrer' : undefined"
:rel="isExternal ? 'noreferrer' : undefined"
>
{{ text }}
</component>
Expand Down
2 changes: 1 addition & 1 deletion src/client/theme-default/components/VPLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const isExternal = computed(() => props.href && /^[a-z]+:/i.test(props.href))
:class="{ link: href }"
:href="href ? normalizeLink(href) : undefined"
:target="isExternal ? '_blank' : undefined"
:rel="isExternal ? 'noopener noreferrer' : undefined"
:rel="isExternal ? 'noreferrer' : undefined"
>
<slot />
<VPIconExternalLink v-if="isExternal && !noIcon" class="icon" />
Expand Down
2 changes: 1 addition & 1 deletion src/client/theme-default/components/VPSocialLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const icons = {
:href="link"
:title="icon"
target="_blank"
rel="noopener noreferrer"
rel="noreferrer"
>
<component :is="icons[icon]" class="icon" />
<span class="visually-hidden">{{ icon }}</span>
Expand Down
2 changes: 1 addition & 1 deletion src/node/markdown/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const createMarkdownRenderer = async (
linkPlugin,
{
target: '_blank',
rel: 'noopener noreferrer',
rel: 'noreferrer',
...options.externalLinks
},
base
Expand Down
2 changes: 1 addition & 1 deletion src/node/markdownToVue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,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(
`<a href="${url}" target="_blank" rel="noopener noreferrer">${url}</a>`
`<a href="${url}" target="_blank" rel="noreferrer">${url}</a>`
)}`
)
)
Expand Down