@@ -266,7 +266,7 @@ export class SearchElement extends LitElement {
266
266
< a
267
267
@click =${ this . followResultLink }
268
268
class ="hit-block-heading"
269
- href="${ result . path } "
269
+ href="${ this . getResultLink ( result ) } "
270
270
>
271
271
< i > ${ listIcon . node [ 0 ] } </ i >
272
272
< h2 > ${ result . title } ${ this . renderExternalProject ( result ) } </ h2 >
@@ -292,6 +292,14 @@ export class SearchElement extends LitElement {
292
292
document . dispatchEvent ( event ) ;
293
293
}
294
294
295
+ getResultLink ( result ) {
296
+ let link = result . path ;
297
+ if ( result . project . slug !== this . config . projects . current . slug ) {
298
+ link = `${ result . domain } ${ result . path } ` ;
299
+ }
300
+ return link ;
301
+ }
302
+
295
303
renderBlockResult ( block , index , result ) {
296
304
// TODO: take a substring of the title as well in case it's too long?
297
305
let title = block . title ;
@@ -318,7 +326,7 @@ export class SearchElement extends LitElement {
318
326
@mouseenter =${ this . mouseenterResultHit }
319
327
@click =${ ( ) => this . storeRecentSearch ( block , result ) }
320
328
class="hit"
321
- href="${ result . path } #${ block . id } "
329
+ href="${ this . getResultLink ( result ) } #${ block . id } "
322
330
>
323
331
< div id ="hit- ${ index } ">
324
332
< p class ="hit subheading "> ${ title } </ p >
@@ -355,7 +363,10 @@ export class SearchElement extends LitElement {
355
363
( { block, result } ) =>
356
364
html `< div class ="hit-block ">
357
365
< div class ="hit-block-heading-container ">
358
- < a class ="hit-block-heading " href ="${ result . path } ">
366
+ < a
367
+ class ="hit-block-heading "
368
+ href ="${ this . getResultLink ( result ) } "
369
+ >
359
370
< i > ${ listIcon . node [ 0 ] } </ i >
360
371
< h2 > ${ result . title } ${ this . renderExternalProject ( result ) } </ h2 >
361
372
</ a >
0 commit comments