mirror of
https://github.com/kogakure/website-astro-stefanimhoff.de.git
synced 2026-02-03 12:05:28 +00:00
21 lines
505 B
Plaintext
21 lines
505 B
Plaintext
---
|
|
interface Props {
|
|
class?: string;
|
|
href?: string;
|
|
[key: string]: any;
|
|
}
|
|
|
|
const { class: className, href = '#', ...props } = Astro.props;
|
|
|
|
const isExternal = (href as string).startsWith('http');
|
|
---
|
|
|
|
<a
|
|
class:list={['link', { external: isExternal }, className]}
|
|
data-umami-event={isExternal ? `Link: ${href.replace(/^(https?:\/\/)/, '')}` : undefined}
|
|
href={href}
|
|
rel={isExternal ? 'nofollow noopener noreferrer' : undefined}
|
|
target={isExternal ? '_blank' : undefined}
|
|
{...props}><slot /></a
|
|
>
|