Moved to next js ssr
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import type { Metadata } from 'next';
|
||||
import UnitPageClient from '@/components/pages/UnitPageClient';
|
||||
import { getMod, getUnit } from '@/lib/api-server';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
interface Props {
|
||||
params: { modId: string; raceId: string; unitId: string };
|
||||
}
|
||||
|
||||
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||
const [mod, unit] = await Promise.all([getMod(params.modId), getUnit(params.unitId)]);
|
||||
if (!mod || !unit) {
|
||||
return { title: 'Unit' };
|
||||
}
|
||||
const title = `${unit.name} — ${mod.name}`;
|
||||
const description = unit.description
|
||||
? `${unit.name} unit in ${mod.name} mod. ${unit.description}`
|
||||
: `${unit.name} unit in ${mod.name} mod. Stats, weapons, abilities.`;
|
||||
return {
|
||||
title,
|
||||
description,
|
||||
alternates: {
|
||||
canonical: `/mod/${params.modId}/race/${params.raceId}/unit/${params.unitId}`,
|
||||
},
|
||||
openGraph: {
|
||||
title,
|
||||
description,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default function UnitPage() {
|
||||
return <UnitPageClient />;
|
||||
}
|
||||
Reference in New Issue
Block a user