Skip to content

Commit 4ae934a

Browse files
committed
2 parents b91fa33 + 8df65b7 commit 4ae934a

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

lib/notion/convertInnerUrl.js

+13-10
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,19 @@ export const convertInnerUrl = allPages => {
2525
}
2626
}
2727

28-
if (anchorTag?.target === '_blank') {
29-
const hrefWithoutQueryHash = anchorTag.href.split('?')[0].split('#')[0]
30-
const hrefWithRelativeHash =
31-
currentURL.split('#')[0] + anchorTag.href.split('#')[1]
32-
33-
if (
34-
currentURL === hrefWithoutQueryHash ||
35-
currentURL === hrefWithRelativeHash
36-
) {
37-
anchorTag.target = '_self'
28+
for (const anchorTag of allAnchorTags) {
29+
if (anchorTag?.target === '_blank') {
30+
const hrefWithoutQueryHash = anchorTag.href
31+
.split('?')[0]
32+
.split('#')[0]
33+
const hrefWithRelativeHash =
34+
currentURL.split('#')[0] || '' + anchorTag.href.split('#')[1] || ''
35+
if (
36+
currentURL === hrefWithoutQueryHash ||
37+
currentURL === hrefWithRelativeHash
38+
) {
39+
anchorTag.target = '_self'
40+
}
3841
}
3942
}
4043
}

0 commit comments

Comments
 (0)