From 664e3e9731b65789d5019c5809af8d07eabf98d9 Mon Sep 17 00:00:00 2001 From: Wesenberg Date: Sun, 12 Jan 2025 20:18:46 +0200 Subject: [PATCH] fix: added rel="noopener noreferrer" to external links for security and privacy --- components/Footer.tsx | 2 ++ islands/ItemsList.tsx | 1 + plugins/blog/components/Share.tsx | 4 ++++ routes/users/[login].tsx | 1 + 4 files changed, 8 insertions(+) diff --git a/components/Footer.tsx b/components/Footer.tsx index ecc559c2..d52b14bf 100644 --- a/components/Footer.tsx +++ b/components/Footer.tsx @@ -66,6 +66,7 @@ export default function Footer() { @@ -74,6 +75,7 @@ export default function Footer() { diff --git a/islands/ItemsList.tsx b/islands/ItemsList.tsx index dfe4add6..7a5b0379 100644 --- a/islands/ItemsList.tsx +++ b/islands/ItemsList.tsx @@ -99,6 +99,7 @@ function ItemSummary(props: ItemSummaryProps) { class="hover:underline text-gray-500 after:content-['_↗']" href={props.item.url} target="_blank" + rel="noopener noreferrer" > {new URL(props.item.url).host} diff --git a/plugins/blog/components/Share.tsx b/plugins/blog/components/Share.tsx index ecf8f927..77879f16 100644 --- a/plugins/blog/components/Share.tsx +++ b/plugins/blog/components/Share.tsx @@ -19,6 +19,7 @@ export default function Share(props: { url: URL; title: string }) { encodeURIComponent(props.url.href) }`} target="_blank" + rel="noopener noreferrer" aria-label={`Share ${props.title} on Facebook`} > @@ -28,6 +29,7 @@ export default function Share(props: { url: URL; title: string }) { encodeURIComponent(props.url.href) }&title=${encodeURIComponent(props.title)}`} target="_blank" + rel="noopener noreferrer" aria-label={`Share ${props.title} on LinkedIn`} > @@ -37,6 +39,7 @@ export default function Share(props: { url: URL; title: string }) { encodeURIComponent(props.url.href) }&title=${encodeURIComponent(props.title)}`} target="_blank" + rel="noopener noreferrer" aria-label={`Share ${props.title} on Reddit`} > @@ -46,6 +49,7 @@ export default function Share(props: { url: URL; title: string }) { encodeURIComponent(props.url.href) }&text=${encodeURIComponent(props.title)}`} target="_blank" + rel="noopener noreferrer" aria-label={`Share ${props.title} on Twitter`} > diff --git a/routes/users/[login].tsx b/routes/users/[login].tsx index 97c8f3ca..c2450f8d 100644 --- a/routes/users/[login].tsx +++ b/routes/users/[login].tsx @@ -27,6 +27,7 @@ function UserProfile(props: UserProfileProps) { aria-label={`${props.login}'s GitHub profile`} class="link-styles" target="_blank" + rel="noopener noreferrer" >