Skip to content

Commit

Permalink
🔍️ Add nofollow and ugc for links
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Dec 2, 2023
1 parent f5dc853 commit edc5c0a
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/components/CivicLikerV3/Page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
preset="secondary-outline"
:href="$t('civic_dashboard_v3_about_url')"
target="_blank"
rel="noreferrer noopener"
rel="noopener"
>
<template #prepend>
<AlertCircle class="w-16 ml-4" />
Expand Down
15 changes: 13 additions & 2 deletions src/components/LinkV2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,30 @@ export default class Link extends Vue {
@Prop({ default: false })
readonly isInline!: boolean;
@Prop({ default: false })
readonly ugc!: boolean;
@Prop({ default: false })
readonly nofollow!: boolean;
@Prop({ default: false })
readonly noreferrer!: boolean;
get tag() {
if (this.to) return 'NuxtLink';
return 'a';
}
get attrs() {
if (this.to) return { to: this.to };
if (this.href)
if (this.href) {
const rel = ['noopener'];
return {
href: this.href,
target: '_blank',
rel: 'noopener',
rel: rel.join(' '),
};
}
return {};
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/NFTCampaign/ItemBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
class="transition-colors cursor-pointer hover:text-like-cyan-dark flex items-center justify-center text-medium-gray mt-[8px]"
:href="isContentViewable ? url : ''"
target="_blank"
rel="noopener"
rel="noopener ugc"
@click="handleClickViewContent"
>
<NFTWidgetIconEye class="w-[17px]" />
Expand Down
2 changes: 1 addition & 1 deletion src/components/NFTPage/ChainDataSection/Metadata.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<a
class="text-medium-gray underline text-[12px]"
:href="contentUrl"
rel="noopener"
rel="noopener ugc"
target="_blank"
>{{ contentUrl }}</a
>
Expand Down
1 change: 1 addition & 0 deletions src/components/NFTPage/EventList/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
class="text-left"
:href="getChainExplorerTx(event.txHash)"
:is-inline="true"
:nofollow="true"
@click.native.stop
>
<TimeAgo
Expand Down
11 changes: 10 additions & 1 deletion src/components/NFTPage/MetadataSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@
content-class="text-medium-gray font-600"
:text="record.label"
/>
<LinkV2 class="text-medium-gray" :href="record.href">
<LinkV2
class="text-medium-gray"
:href="record.href"
:nofollow="!!record.nofollow"
:ugc="!!record.ugc"
>
<Label class="truncate" preset="p6" :is-raw="true">{{
record.text
}}</Label>
Expand Down Expand Up @@ -75,6 +80,7 @@ export default {
label: this.$t('nft_details_page_section_metadata_url'),
href: this.contentUrl,
text: this.contentUrl,
ugc: true,
},
{
label: this.$t('nft_details_page_section_metadata_iscn'),
Expand All @@ -91,20 +97,23 @@ export default {
label: this.$t('nft_details_page_section_metadata_ar'),
href: `${ARWEAVE_ENDPOINT}/${text}`,
text,
nofollow: true,
});
break;
case 'ipfs':
records.push({
label: this.$t('nft_details_page_section_metadata_ipfs'),
href: `${IPFS_VIEW_GATEWAY_URL}/${text}`,
text,
nofollow: true,
});
break;
case 'num':
records.push({
label: this.$t('nft_details_page_section_metadata_ipfs'),
href: `${APP_LIKE_CO_URL_BASE}/api/numbers-protocol/assets/${text}`,
text,
nofollow: true,
});
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/components/NFTPage/PreviewCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class="rounded-t-[inherit] overflow-hidden"
:href="url || iscnUrl"
target="_blank"
rel="noopener"
:rel="url ? 'noopener ugc' : 'noopener'"
>
<NFTCover
:src="imageUrl"
Expand Down
10 changes: 1 addition & 9 deletions src/pages/eula.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,7 @@
described herein. The terms also apply to any oice Limited updates,
supplements, Internet-based services, and support services for the
Software, unless other terms accompany those items on delivery. If so,
those terms apply. This EULA was created by
<a
class="text-like-green"
href="https://www.eulatemplate.com/"
target="_blank"
rel="noopener nofollow"
>EULA Template</a
>
for Liker Land.
those terms apply.
</p>
<h2>License Grant</h2>
<p>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
class="settings-menu__item"
:href="likerIdSettingsURL"
target="_blank"
rel="noreferrer noopener"
rel="noopener"
>
<span class="settings-menu__item-title">
{{ $t('settings_liker_id') }}</span
Expand Down

0 comments on commit edc5c0a

Please sign in to comment.