refactor: use a custom Link component to be able to use absolute URLs everywhere

...that supports any `base` property
This commit is contained in:
Joakim Carlstein 2023-12-19 09:57:23 +01:00
parent bdf831b008
commit ca6834d95f
21 changed files with 89 additions and 53 deletions

View file

@ -0,0 +1,11 @@
---
interface Props {
href: string;
}
const base = import.meta.env.BASE_URL === '/' || !import.meta.env.BASE_URL ? '' : import.meta.env.BASE_URL;
const site = import.meta.env.SITE ?? '';
const { href } = Astro.props;
---
<a href={`${site}${base}${href}`}><slot /></a>