diff --git a/src/env/schema.mjs b/src/env/schema.mjs index 05c6629..c7091aa 100644 --- a/src/env/schema.mjs +++ b/src/env/schema.mjs @@ -8,6 +8,10 @@ import { z } from "zod"; export const serverSchema = z.object({ DIRECTUS_REVALIDATE_KEY: z.string(), NODE_ENV: z.enum(["development", "test", "production"]), + TITLE: z.preprocess((value) => { + if (value === undefined || value === "") return null; + return value; + }, z.string().nullable()), }); /** diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 9fa69d1..86958f5 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,13 +1,14 @@ import AppWrapper from "@/components/AppWrapper"; +import { env } from "@/env/server.mjs"; import directus from "@/utils/directus"; import { readSingleton } from "@directus/sdk"; import { GetStaticPropsResult, type NextPage } from "next"; import Head from "next/head"; import Link from "next/link"; -import { useEffect, useState } from "react"; import Balancer from "react-wrap-balancer"; type IndexProps = { + title: string; tagline: string; buttons: { text: string; href: string }[]; }; @@ -23,6 +24,7 @@ export async function getStaticProps(): Promise< return { props: { + title: env.TITLE ?? "Xevion", tagline: metadata.tagline, buttons: [ { text: "GitHub", href: "https://github.com/Xevion" }, @@ -36,15 +38,11 @@ export async function getStaticProps(): Promise< }; } -const Home: NextPage = ({ tagline, buttons }: IndexProps) => { - const [isWalters, setIsWalters] = useState(false); - useEffect(() => { - // Check if URL contains "walters.to" - if (location.href.includes("walters.to")) { - setIsWalters(true); - } - }, []); - +const Home: NextPage = ({ + title, + tagline, + buttons, +}: IndexProps) => { return ( <> @@ -70,7 +68,7 @@ const Home: NextPage = ({ tagline, buttons }: IndexProps) => {

- {isWalters ? "Walters" : "Xevion"} + {title}