Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/flo-bit/tiny-docs. quick setup, simple, minimalistic docs for your github project flo-bit.dev/tiny-docs
Something went wrong. Try again.
860 B · 40 lines
Astro
at v1
1234567891011121314151617181920212223242526272829303132333435363738394041---const { href }: Record<string, any> = Astro.props;
const domain = import.meta.env.SITE;let attr: { target?: string; rel?: string } = {};
let isExternal = false;
if ( !href.includes(domain) && !href.startsWith("/") && !href.startsWith("#") && !href.startsWith(".")) { attr["target"] = "_blank"; attr["rel"] = "noopener noreferrer"; isExternal = true;}---
<a href={href} {...attr} class="inline-flex items-center justify-center gap-1" ><slot /> { isExternal ? ( <svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" > <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" /> </svg> ) : null }</a>