2025-01-22 13:43:44 +02:00
|
|
|
import type { LayoutServerData } from './$types';
|
2025-01-31 18:38:44 +02:00
|
|
|
import { site } from '$lib/config';
|
|
|
|
import games from '$lib/data/games';
|
2025-01-22 13:43:44 +02:00
|
|
|
|
|
|
|
export const load: LayoutServerData = async ({ url }) => {
|
2025-01-22 14:25:24 +02:00
|
|
|
if (!url?.pathname) {
|
|
|
|
return;
|
|
|
|
}
|
2025-01-22 13:43:44 +02:00
|
|
|
|
2025-01-31 18:38:44 +02:00
|
|
|
const gameSlug = url.pathname.split('/').at(-1);
|
|
|
|
|
|
|
|
const game = games[gameSlug];
|
2025-01-22 13:43:44 +02:00
|
|
|
|
2025-01-22 14:25:24 +02:00
|
|
|
if (!game) {
|
|
|
|
return;
|
|
|
|
}
|
2025-01-22 13:43:44 +02:00
|
|
|
|
2025-01-22 14:25:24 +02:00
|
|
|
return {
|
|
|
|
name: game.name,
|
2025-01-22 18:08:27 +02:00
|
|
|
description: game.description || site.description,
|
|
|
|
image: game.image || site.image
|
2025-01-22 14:25:24 +02:00
|
|
|
};
|
2025-01-22 13:43:44 +02:00
|
|
|
};
|