portfolio_site/src/routes/vinge/+layout.server.ts

24 lines
454 B
TypeScript
Raw Normal View History

import type { LayoutServerData } from './$types';
import { site } from '$lib/config';
import games from '$lib/data/games';
export const load: LayoutServerData = async ({ url }) => {
2025-01-22 14:25:24 +02:00
if (!url?.pathname) {
return;
}
const gameSlug = url.pathname.split('/').at(-1);
const game = games[gameSlug];
2025-01-22 14:25:24 +02:00
if (!game) {
return;
}
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
};
};