From d95e26d55cb528e0fbf07595dad742bb8cc8fdf8 Mon Sep 17 00:00:00 2001 From: Peer Richelsen Date: Mon, 20 Dec 2021 09:11:39 +0000 Subject: [PATCH] fixes 404 for subpaths, adds prefilled url to sign up form (#1355) * fixes 404 for subpaths, adds prefilled url to sign up form * Added tweak to support BASE_URL for self hosted (#1356) * Added tweak to support BASE_URL for self hosted (without linking to our signup) * also hides the signup popular page Co-authored-by: Alex van Andel --- pages/404.tsx | 73 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 30 deletions(-) diff --git a/pages/404.tsx b/pages/404.tsx index 0c3f2430b3dc2a..e14f5b46500dc0 100644 --- a/pages/404.tsx +++ b/pages/404.tsx @@ -26,7 +26,7 @@ export default function Custom404() { title: t("api_reference"), description: t("api_reference_description"), icon: CodeIcon, - href: "https://api.docs.cal.com", + href: "https://developer.cal.com", }, { title: t("blog"), @@ -36,7 +36,7 @@ export default function Custom404() { }, ]; - const isEventType404 = router.asPath.includes("/event-types"); + const isSubpage = router.asPath.includes("/", 2); return ( <> @@ -48,36 +48,49 @@ export default function Custom404() { noindex: true, }} /> -
-
+
+
-

404 error

-

+

404 error

+

{t("page_doesnt_exist")}

- {isEventType404 ? ( + {isSubpage ? ( {t("check_spelling_mistakes_or_go_back")} - ) : ( - + ) : process.env.NEXT_PUBLIC_BASE_URL == "https://app.cal.com" ? ( + {t("the_username")} cal.com{username}{" "} {t("is_still_available")} {t("register_now")}. + ) : ( + <> + {t("the_username")}{" "} + + {new URL(process.env.NEXT_PUBLIC_BASE_URL || "").hostname} + {username} + {" "} + {t("is_still_available")} + )}