Skip to content

Commit

Permalink
🔍️ Add nofollow and ugc tags for urls
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Dec 2, 2023
1 parent 4338fd2 commit 55d4ecf
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions components/Alerts/SignFailed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Link
place="buy"
:class="['text-white', 'ml-[2px]']"
nofollow="true"
href="https://go.crisp.chat/chat/embed/?website_id=5c009125-5863-4059-ba65-43f177ca33f7"
>
{{ $t('IscnRegisterForm.error.buy') }}
Expand Down
2 changes: 1 addition & 1 deletion components/ContentFingerprintLink.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<Link v-if="href" :href="href">
<Link v-if="href" :href="href" :nofollow="true">
{{ item }}
</Link>
<div v-else>
Expand Down
1 change: 1 addition & 0 deletions components/IscnRegisterForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@
<Link
v-if="error === 'INSUFFICIENT_BALANCE'"
:class="['text-white','ml-[2px]']"
nofollow="true"
href="https://app.osmosis.zone/?from=USDC&to=LIKE"
>
{{ $t('IscnRegisterForm.error.buy') }}
Expand Down
1 change: 1 addition & 0 deletions components/IscnUploadForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
<Link
v-if="error === 'INSUFFICIENT_BALANCE'"
:class="['text-white','ml-[2px]']"
nofollow="true"
href="https://app.osmosis.zone/?from=USDC&to=LIKE"
>
{{ $t('IscnRegisterForm.error.buy') }}
Expand Down
1 change: 1 addition & 0 deletions components/IscnUploadedInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
'text-[14px]',
'break-all',
]"
nofollow="true"
:href="transactionsURL"
>
{{ iscnHash }}
Expand Down
9 changes: 8 additions & 1 deletion components/Link.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,24 @@ export default class Link extends Vue {
// Equivalent to `to` of `<NuxtLink/>`
@Prop({ default: null }) readonly to: object | null | undefined
@Prop(String) readonly href: string | undefined
@Prop({ default: false }) readonly nofollow!: boolean
@Prop({ default: false }) readonly noreferrer!: boolean
@Prop({ default: false }) readonly ugc!: boolean
@Prop({ default: false }) readonly isInline!: boolean
get attrs() {
if (this.to) {
return { to: this.to }
}
if (this.href) {
const rel = ['noopener']
if (this.nofollow) { rel.push('nofollow') }
if (this.noreferrer) { rel.push('noreferrer') }
if (this.ugc) { rel.push('ugc') }
return {
href: this.href,
target: '_blank',
rel: 'noopener noreferrer',
rel: rel.join(' '),
}
}
return {}
Expand Down
4 changes: 4 additions & 0 deletions pages/view/_iscnId/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
'text-[14px]',
'break-all',
]"
nofollow="true"
:href="transactionsURL">
{{ txHash }}
</Link>
Expand Down Expand Up @@ -306,6 +307,7 @@
'break-all',
]"
:href="metadata.url"
ugc="true"
>
{{ metadata.url }}
</Link>
Expand All @@ -321,6 +323,7 @@
'text-[14px]',
'break-all',
]"
ugc="true"
:href="metadata.usageInfo"
>
{{ metadata.usageInfo }}
Expand Down Expand Up @@ -415,6 +418,7 @@
:key="url"
:href="url"
class="break-all"
:ugc="true"
>{{ url }}</Link
>
</FormField>
Expand Down

0 comments on commit 55d4ecf

Please sign in to comment.