mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-11-18 07:22:06 +00:00
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:
@@ -1,5 +1,7 @@
|
||||
import { Metadata } from "next";
|
||||
import { unstable_cache } from "next/cache";
|
||||
|
||||
import { baseUrl } from "@/constants";
|
||||
import { collections, dbConnect } from "@/server/mongodb";
|
||||
import { Club } from "@/types";
|
||||
import { filterClubsByManualEntry } from "@/utils/clubFilters";
|
||||
@@ -9,6 +11,23 @@ import ClubsDisplay from "./ClubsDisplay";
|
||||
|
||||
export const revalidate = 3600; // Revalidate cache every 6 hours
|
||||
|
||||
export async function generateMetadata({
|
||||
params: { locale },
|
||||
}: {
|
||||
params: { locale?: string };
|
||||
}): Promise<Metadata> {
|
||||
return {
|
||||
alternates: {
|
||||
canonical:
|
||||
locale === "fr" ? `${baseUrl}/clubs` : `${baseUrl}/${locale}/clubs`,
|
||||
languages: {
|
||||
fr: `${baseUrl}/clubs`,
|
||||
en: `${baseUrl}/en/clubs`,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const getClubs = async () => {
|
||||
try {
|
||||
await dbConnect();
|
||||
|
||||
Reference in New Issue
Block a user