File tree 1 file changed +13
-10
lines changed
1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -25,16 +25,19 @@ export const convertInnerUrl = allPages => {
25
25
}
26
26
}
27
27
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
+ }
38
41
}
39
42
}
40
43
}
You can’t perform that action at this time.
0 commit comments