Moved to next js ssr
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import type { Metadata } from 'next';
|
||||
import BuildingPageClient from '@/components/pages/BuildingPageClient';
|
||||
import { getBuilding, getMod } from '@/lib/api-server';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
interface Props {
|
||||
params: { modId: string; raceId: string; buildingId: string };
|
||||
}
|
||||
|
||||
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||
const [mod, building] = await Promise.all([getMod(params.modId), getBuilding(params.buildingId)]);
|
||||
if (!mod || !building) {
|
||||
return { title: 'Building' };
|
||||
}
|
||||
let buildingName = building.name;
|
||||
if (!buildingName) {
|
||||
buildingName = building.filename.replaceAll('_', ' ').replace('.rgd', '');
|
||||
}
|
||||
const title = `${buildingName} — ${mod.name}`;
|
||||
const description = `${buildingName} building in ${mod.name} mod. Stats, production, researches.`;
|
||||
return {
|
||||
title,
|
||||
description,
|
||||
alternates: {
|
||||
canonical: `/mod/${params.modId}/race/${params.raceId}/building/${params.buildingId}`,
|
||||
},
|
||||
openGraph: {
|
||||
title,
|
||||
description,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default function BuildingPage() {
|
||||
return <BuildingPageClient />;
|
||||
}
|
||||
Reference in New Issue
Block a user