feat: add opengraph tags
All checks were successful
deploy to cloudflare pages / deploy (push) Successful in 34s

This commit is contained in:
uku 2024-11-27 12:10:03 +01:00
parent 219d590e71
commit 650fa5fb4c
Signed by: uku
SSH key fingerprint: SHA256:4P0aN6M8ajKukNi6aPOaX0LacanGYtlfjmN+m/sHY/o
4 changed files with 12 additions and 1 deletions

View file

@ -4,6 +4,12 @@
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.avif" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="og:title" content="TCL-Guessr" />
<meta name="og:type" content="website" />
<meta name="og:image" content="%sveltekit.assets%/favicon.avif" />
<meta name="theme-color" content="#ff0000" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">

View file

@ -16,6 +16,7 @@
</script>
<svelte:head>
<meta name="og:description" content="Tableau des scores" />
<title>Tableau des scores</title>
</svelte:head>

View file

@ -3,6 +3,7 @@ import { error } from "@sveltejs/kit";
interface JoinedRoundScore {
mode: string;
stops_type: string;
total_score: number;
name: string;
points: number;
@ -19,7 +20,7 @@ export const load: PageServerLoad = async ({ locals, url, platform }) => {
const { results } = await db
.prepare(
"SELECT game.mode, game.total_score, user.name, round.points, round.distance, round.stop_name FROM game INNER JOIN round ON round.game_id = game.id LEFT JOIN user ON user.id = game.user_id WHERE game.id = ?;",
"SELECT game.mode, game.stops_type, game.total_score, user.name, round.points, round.distance, round.stop_name FROM game INNER JOIN round ON round.game_id = game.id LEFT JOIN user ON user.id = game.user_id WHERE game.id = ?;",
)
.bind(gameId)
.all<JoinedRoundScore>();

View file

@ -9,12 +9,15 @@
const totalScore = props.data.rounds[0].total_score;
const mode = props.data.rounds[0].mode;
const stops_type = props.data.rounds[0].stops_type;
const name = props.data.rounds[0].name;
const saveParams = new URLSearchParams({ next: `/api/save?id=${props.data.gameId}` });
const ogDesc = `${totalScore} points par ${name ?? "inconnu"} - Difficulté: ${mode} - Arrêts: ${stops_type}`;
</script>
<svelte:head>
<meta name="og:description" content={ogDesc} />
<title>TCL-Guessr - Résultats</title>
</svelte:head>