diff --git a/src/env/schema.mjs b/src/env/schema.mjs index 05c6629..494ab7f 100644 --- a/src/env/schema.mjs +++ b/src/env/schema.mjs @@ -7,6 +7,10 @@ import { z } from "zod"; */ export const serverSchema = z.object({ DIRECTUS_REVALIDATE_KEY: z.string(), + OVERRIDE_TITLE: z.preprocess((v) => { + if (v === undefined || v === "") return null; + return v; + }, z.string().nullable()), NODE_ENV: z.enum(["development", "test", "production"]), }); diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 82b7d7e..2f6dcbf 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,4 +1,5 @@ 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"; @@ -7,6 +8,7 @@ import Link from "next/link"; import Balancer from "react-wrap-balancer"; type IndexProps = { + title: string | null; tagline: string; buttons: { text: string; href: string }[]; }; @@ -23,6 +25,7 @@ export async function getStaticProps(): Promise< return { props: { tagline: metadata.tagline, + title: env.OVERRIDE_TITLE, buttons: [ { text: "GitHub", href: "https://github.com/Xevion" }, { text: "Projects", href: "/projects" }, @@ -35,7 +38,11 @@ export async function getStaticProps(): Promise< }; } -const Home: NextPage = ({ tagline, buttons }: IndexProps) => { +const Home: NextPage = ({ + title, + tagline, + buttons, +}: IndexProps) => { return ( <> @@ -61,7 +68,7 @@ const Home: NextPage = ({ tagline, buttons }: IndexProps) => {

- Xevion + {title ?? "Xevion"}