web/OuterLink: don't set target/rel for relative links
This commit is contained in:
parent
6d95700075
commit
4777d69cd7
1 changed files with 10 additions and 1 deletions
|
@ -5,8 +5,17 @@
|
|||
// no way to change this behavior atm (https://github.com/pngwn/MDsveX/issues/609)
|
||||
export let rel: string = "";
|
||||
rel;
|
||||
|
||||
const [ target, _rel ] = (() => {
|
||||
try {
|
||||
new URL(href)
|
||||
return [ '_blank', 'noopener noreferrer' ];
|
||||
} catch {}
|
||||
|
||||
return [];
|
||||
})();
|
||||
</script>
|
||||
|
||||
<a target="_blank" rel="noopener noreferrer" {href}>
|
||||
<a rel={_rel} {target} {href}>
|
||||
<slot></slot>
|
||||
</a>
|
||||
|
|
Loading…
Reference in a new issue