mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 12:50:01 +00:00
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)
|
// no way to change this behavior atm (https://github.com/pngwn/MDsveX/issues/609)
|
||||||
export let rel: string = "";
|
export let rel: string = "";
|
||||||
rel;
|
rel;
|
||||||
|
|
||||||
|
const [ target, _rel ] = (() => {
|
||||||
|
try {
|
||||||
|
new URL(href)
|
||||||
|
return [ '_blank', 'noopener noreferrer' ];
|
||||||
|
} catch {}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a target="_blank" rel="noopener noreferrer" {href}>
|
<a rel={_rel} {target} {href}>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in a new issue