Make passport link root on subdomains

cgen-cb74c49f8bb24985bc7cfb884473e720
This commit is contained in:
Builder.io 2025-11-15 05:32:53 +00:00
parent 6db4218ff6
commit 17e1324919

View file

@ -122,7 +122,23 @@ export default function CodeLayout({ children, hideFooter }: LayoutProps) {
{ name: "Contact", href: "/contact" },
];
const passportHref = profile?.username
const isSubdomainHost = (() => {
try {
const hostname = typeof window !== "undefined" ? window.location.hostname : "";
if (!hostname) return false;
if (hostname.includes("aethex.me") || hostname.includes("aethex.space")) {
const parts = hostname.split(".");
return parts.length > 2;
}
return false;
} catch (e) {
return false;
}
})();
const passportHref = isSubdomainHost
? "/"
: profile?.username
? `/passport/${profile.username}`
: "/passport/me";