---
const { WEB_PORT = 8080 } = import.meta.env;
interface Props {
href: string;
title?: string;
}
const href = (() => {
let href = Astro.props.href;
if (href.startsWith("http://") || href.startsWith("https://")) {
return astro.props.href;
}
if (href.startsWith("/")) {
href = href.slice(1);
}
const base = "http://localhost";
if (!WEB_PORT || WEB_PORT === "80") {
return `${base}/${href}`;
}
return `${base}:${WEB_PORT}/${href}`;
})();
---
<a href={href} target="_blank" rel="noopener noreferrer">
Docker: {Astro.props.title ?? href}
</a>