Skip to content

Commit 687c8d4

Browse files
Merge pull request #436 from JoPrignol/add-rel-prop
feat: added a rel prop
2 parents 910e81b + 08f3a2c commit 687c8d4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

docs/content/2.usage/1.component.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ The component will render by default the following minimal HTML:
4141
href="{share url}"
4242
style="--color-brand: {network brand color};"
4343
aria-label="Share with {network}"
44+
rel="nofollow noopener noreferrer"
4445
target="_blank"
4546
>
4647
<svg class="social-share-button__icon">{...}</svg>
@@ -133,6 +134,14 @@ Comma separated list of hashtags used as a parameter of the sharing URL, in netw
133134

134135
Image path used as a parameter of the sharing URL, in networks that support it. Optional, check the list of [supported networks](/usage/supported-networks).
135136

137+
### `rel`
138+
139+
- Required: `No`
140+
- Type: `String`
141+
- Default: `nofollow noopener noreferrer`
142+
143+
Sets some default values to the `rel` attribute of the link anchor. Customizable if needed, sets by default the [`nofollow`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/rel#nofollow), [`noopener`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/rel#noopener) and [`noreferrer`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/rel#noreferrer) for both SEO and security concerns.
144+
136145
## Slots
137146

138147
::note

src/runtime/SocialShare.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
:href="selectedNetwork.shareUrl"
77
:style="`--color-brand:${selectedNetwork.color}`"
88
:aria-label="`Share with ${selectedNetwork.name}`"
9+
:rel="rel"
910
target="_blank"
1011
>
1112
<template v-if="hasIcon">
@@ -37,6 +38,8 @@ const props = defineProps({
3738
user: { type: String, default: undefined },
3839
hashtags: { type: String, default: undefined },
3940
image: { type: String, default: undefined },
41+
// Link props
42+
rel: { type: String, default: 'nofollow noopener noreferrer' },
4043
})
4144
4245
const moduleOptions = useRuntimeConfig().public.socialShare

0 commit comments

Comments
 (0)