web/OuterLink: don't set target/rel for relative links

This commit is contained in:
dumbmoron 2024-09-09 11:02:32 +00:00
parent 6d95700075
commit 4777d69cd7
No known key found for this signature in database

View file

@ -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>