From 42640bceb57c450d5c2427bd2b449827468d0ede Mon Sep 17 00:00:00 2001 From: Paul Trotter Date: Mon, 17 Jun 2024 00:33:28 -0500 Subject: [PATCH] Check link isExternal before adding target="_blank" (#1211) Fixes #1186 openLinksInNewTab opens ALL links in new tabs. Fixed to reflect documented behavior here: https://quartz.jzhao.xyz/plugins/CrawlLinks --- quartz/plugins/transformers/links.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartz/plugins/transformers/links.ts b/quartz/plugins/transformers/links.ts index f89d367d7..280581828 100644 --- a/quartz/plugins/transformers/links.ts +++ b/quartz/plugins/transformers/links.ts @@ -93,7 +93,7 @@ export const CrawlLinks: QuartzTransformerPlugin | undefined> = } node.properties.className = classes - if (opts.openLinksInNewTab) { + if (isExternal && opts.openLinksInNewTab) { node.properties.target = "_blank" }