File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -210,11 +210,14 @@ const LinkToPage = React.memo(function LinkToPage({
210210 asPath : string
211211} ) {
212212 const isActive = route === asPath . split ( '/?' ) [ 0 ] . split ( '?' ) [ 0 ]
213+ const isExternal = route . startsWith ( 'http' )
213214
214215 return (
215216 < BasicLink
216217 href = { route }
217218 data-linkactive = { isActive }
219+ target = { isExternal ? '_blank' : undefined }
220+ rel = { isExternal ? 'noopener noreferrer' : undefined }
218221 className = "group/link -ml-1.5 flex flex-1 items-center gap-3 rounded-md p-1.5 hover:bg-black/5 focus-visible:bg-black/5 data-[linkactive=true]:bg-(--link-active-bg) data-[linkactive=true]:text-white dark:hover:bg-white/10 dark:focus-visible:bg-white/10"
219222 >
220223 { icon ? (
Original file line number Diff line number Diff line change @@ -168,9 +168,13 @@ const LinkToPage = React.memo(function LinkToPage({
168168 setShow : ( show : boolean ) => void
169169} ) {
170170 const isActive = route === asPath . split ( '/?' ) [ 0 ] . split ( '?' ) [ 0 ]
171+ const isExternal = route . startsWith ( 'http' )
172+
171173 return (
172174 < BasicLink
173175 href = { route }
176+ target = { isExternal ? '_blank' : undefined }
177+ rel = { isExternal ? 'noopener noreferrer' : undefined }
174178 data-linkactive = { isActive }
175179 className = "-ml-1.5 flex items-center gap-3 rounded-md p-1.5 hover:bg-black/5 focus-visible:bg-black/5 data-[linkactive=true]:bg-(--link-active-bg) data-[linkactive=true]:text-white dark:hover:bg-white/10 dark:focus-visible:bg-white/10"
176180 onClick = { ( ) => setShow ( false ) }
You can’t perform that action at this time.
0 commit comments