Skip to content

Commit 68da001

Browse files
committed
feat: add nofollow
1 parent ef65573 commit 68da001

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

apps/gallery/app/[platform]/[category]/[pattern]/[quality]/[id]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export default async function PatternDetailPage({ params }: PageProps) {
233233
<a
234234
href={entry.source.url}
235235
target="_blank"
236-
rel="noopener noreferrer"
236+
rel="noopener noreferrer nofollow"
237237
className="inline-flex items-center gap-2 px-4 py-2 bg-fd-primary text-fd-primary-foreground rounded-lg hover:bg-fd-primary/90 transition-colors ml-auto"
238238
>
239239
<span>View on {entry.website}</span>

apps/gallery/components/common/header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export function Header() {
6464
key={social.label}
6565
href={social.link}
6666
target="_blank"
67-
rel="noopener noreferrer"
67+
rel="noopener noreferrer nofollow"
6868
className={`text-fd-muted-foreground hover:text-fd-foreground transition-colors ${TRACKING_CLASSES.FOOTER_SOCIAL_CLICK}`}
6969
>
7070
{social.icon}

apps/gallery/components/entries/entry-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export function EntryModal({
9292
<a
9393
href={`https://${entry.website}`}
9494
target="_blank"
95-
rel="noopener noreferrer"
95+
rel="noopener noreferrer nofollow"
9696
className="inline-block hover:opacity-80 transition-opacity"
9797
>
9898
<WebsitePill

apps/gallery/components/stars/stars.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const Stars = ({
4545
<a
4646
href="https://github.com/thedaviddias/ux-patterns-for-developers"
4747
target="_blank"
48-
rel="noopener noreferrer"
48+
rel="noopener noreferrer nofollow"
4949
onClick={() => plausible(GALLERY_TRACKING_EVENTS.GITHUB_STAR_CLICK)}
5050
className={className}
5151
aria-label="Star on GitHub"

apps/gallery/lib/mdx-components.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,20 @@ export function useMDXComponents(components: MDXComponents): MDXComponents {
1717
);
1818
}
1919

20-
// Default link behavior
20+
// Check if it's an external link (not your own domains)
21+
const isExternal =
22+
href &&
23+
typeof href === "string" &&
24+
(href.startsWith("http://") || href.startsWith("https://")) &&
25+
!href.includes("uxpatterns.dev") &&
26+
!href.includes("kit.uxpatterns.dev") &&
27+
!href.includes("thedaviddias.com");
28+
29+
// Add nofollow to external links
30+
const rel = isExternal ? "nofollow" : undefined;
31+
2132
return (
22-
<a href={href} {...props}>
33+
<a href={href} rel={rel} {...props}>
2334
{children}
2435
</a>
2536
);

0 commit comments

Comments
 (0)