From 67641c5719ba962781b4e53b57b340b613d230f4 Mon Sep 17 00:00:00 2001 From: Leander Furumo Date: Fri, 30 Oct 2026 22:56:08 +0100 Subject: [PATCH] Don't open mailto: and internal links in a new tab target="_blank" on mailto: links leaves an empty tab behind. In blog posts, only links to other sites now open in a new tab. Co-Authored-By: Claude Opus 5.5 --- src/app/[locale]/blog/[slug]/page.tsx | 7 +++++-- src/components/page-sections/contact.tsx | 4 +--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app/[locale]/blog/[slug]/page.tsx b/src/app/[locale]/blog/[slug]/page.tsx index 2ac29ad..7df83f1 100644 --- a/src/app/[locale]/blog/[slug]/page.tsx +++ b/src/app/[locale]/blog/[slug]/page.tsx @@ -102,12 +102,15 @@ const components: PortableTextComponents = { const href = getSafeHref(value?.href) if (!href) return <>{children} + // Only links to other sites open in a new tab, not mailto: or links + // within this site + const isExternal = /^https?:\/\//i.test(href) + return ( {children} diff --git a/src/components/page-sections/contact.tsx b/src/components/page-sections/contact.tsx index 08d61cd..12e9035 100644 --- a/src/components/page-sections/contact.tsx +++ b/src/components/page-sections/contact.tsx @@ -22,9 +22,7 @@ const Contact = () => {
- - {t("email")} - + {t("email")}