From 4a9fb98ad5c762c431802fceb93fa5a9ac59e4fc Mon Sep 17 00:00:00 2001 From: Benjamin Okkema Date: Sun, 25 Aug 2024 21:05:56 -0500 Subject: [PATCH] fix: external link condition --- src/utils/posts.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/posts.ts b/src/utils/posts.ts index 7efa9d4..45f4671 100644 --- a/src/utils/posts.ts +++ b/src/utils/posts.ts @@ -29,7 +29,7 @@ export async function renderMarkdown(markdown: string) { const matches = Array.from(html.matchAll(regex)) if (matches.length) { for (const [link, href, _, content] of matches) { - if (href != "/") { + if (!href.startsWith("/")) { const external = link.replace(content, `${content}`) .replace(href, `${href}" target="_blank`) html = html.replace(link, external)