Make passport link root on subdomains
cgen-cb74c49f8bb24985bc7cfb884473e720
This commit is contained in:
parent
6db4218ff6
commit
17e1324919
1 changed files with 17 additions and 1 deletions
|
|
@ -122,7 +122,23 @@ export default function CodeLayout({ children, hideFooter }: LayoutProps) {
|
||||||
{ name: "Contact", href: "/contact" },
|
{ 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/${profile.username}`
|
||||||
: "/passport/me";
|
: "/passport/me";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue