
Also move games, badges from config.ts and projects from project page defintion to /src/lib/data
23 lines
454 B
TypeScript
23 lines
454 B
TypeScript
import type { LayoutServerData } from './$types';
|
|
import { site } from '$lib/config';
|
|
import games from '$lib/data/games';
|
|
|
|
export const load: LayoutServerData = async ({ url }) => {
|
|
if (!url?.pathname) {
|
|
return;
|
|
}
|
|
|
|
const gameSlug = url.pathname.split('/').at(-1);
|
|
|
|
const game = games[gameSlug];
|
|
|
|
if (!game) {
|
|
return;
|
|
}
|
|
|
|
return {
|
|
name: game.name,
|
|
description: game.description || site.description,
|
|
image: game.image || site.image
|
|
};
|
|
};
|