canonical URL, a11y, and LCP improvements

add metadata, moving splitting client and server component when needed as metadata is not allowed in a client component

reusable baseUrl

set x-url header for use in canonical urls for each page

remove hardcoded title tag

remove user-scalable=no to pass a11y checks, since it is ignored anyway by browsers now

LCP set as priority loading
This commit is contained in:
2026-01-30 15:05:48 +01:00
committed by owenrees
parent 7adff99e28
commit df3a73df88
9 changed files with 419 additions and 326 deletions
@@ -6,8 +6,10 @@ import {
} from "date-fns";
import { fr } from "date-fns/locale";
import { groupBy } from "lodash";
import { Metadata } from "next";
import { unstable_cache } from "next/cache";
import { baseUrl } from "@/constants";
import { tournamentModelSchema } from "@/server/models/tournamentModel";
import { collections, dbConnect } from "@/server/mongodb";
import { TimeControl, Tournament, tcMap } from "@/types";
@@ -17,6 +19,25 @@ import TournamentsDisplay from "./TournamentsDisplay";
setDefaultOptions({ locale: fr });
export async function generateMetadata({
params: { locale },
}: {
params: { locale?: string };
}): Promise<Metadata> {
return {
alternates: {
canonical:
locale === "fr"
? `${baseUrl}/tournois`
: `${baseUrl}/${locale}/tournaments`,
languages: {
fr: `${baseUrl}/tournois`,
en: `${baseUrl}/en/tournaments`,
},
},
};
}
const getTournaments = async () => {
try {
await dbConnect();