Skip to content

Commit

Permalink
fix links pt. 2
Browse files Browse the repository at this point in the history
  • Loading branch information
HJfod committed Mar 4, 2024
1 parent f56d73c commit 1ba5458
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/Button.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
const { link, style } = Astro.props;
const url = `${import.meta.env.BASE_URL}${link}`;
const url = link.startsWith('https') ? link : `${import.meta.env.BASE_URL}${link}`;
---

<a href={url} class={style}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Link.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
const { href, style, noUnderline } = Astro.props;
const classList = `${style} ${noUnderline === 'true' ? 'no-link-underline' : ''}`;
const url = `${import.meta.env.BASE_URL}${href}`;
const url = href.startsWith('https') ? href : `${import.meta.env.BASE_URL}${href}`;
---
<!-- this is to prevent any unintended whitespace appearing after the link --><a href={url} class={classList}><slot/></a><style>
a {
Expand Down

0 comments on commit 1ba5458

Please sign in to comment.