mirror of
https://github.com/UiO-Gaming/uiogaming.no.git
synced 2026-11-05 13:56:47 +01:00
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
70ba50c515
commit
67641c5719
2 files changed
+6
-5
No files matched your search
@@ -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 (
|
||||
<a
|
||||
href={href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={styles.link}
|
||||
{...(isExternal && { target: "_blank", rel: "noopener noreferrer" })}
|
||||
>
|
||||
{children}
|
||||
</a>
|
||||
|
||||
@@ -22,9 +22,7 @@ const Contact = () => {
|
||||
<div className={styles.container}>
|
||||
<div className={styles.item}>
|
||||
<FaAt />
|
||||
<a href="mailto:styret@uiogaming.no" target="_blank" rel="noreferrer">
|
||||
{t("email")}
|
||||
</a>
|
||||
<a href="mailto:styret@uiogaming.no">{t("email")}</a>
|
||||
</div>
|
||||
<div className={styles.item}>
|
||||
<FaDiscord />
|
||||
|
||||
Reference in new issue
Block a user