fix: include server load data in universal load for recipe page title
The +page.server.ts fetches recipe data and strips HTML tags server-side to avoid bundling cheerio in the client. However, the universal load in +page.ts wasn't including this data in its return value. Fixed by: 1. Having +page.server.ts fetch the recipe directly (since it runs before +page.ts and can't access its data via parent()) 2. Adding the `data` parameter to +page.ts and spreading it in the return Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { error } from "@sveltejs/kit";
|
||||
import { generateRecipeJsonLd } from '$lib/js/recipeJsonLd';
|
||||
|
||||
export async function load({ fetch, params, url}) {
|
||||
export async function load({ fetch, params, url, data }) {
|
||||
const isEnglish = params.recipeLang === 'recipes';
|
||||
const apiBase = isEnglish ? '/api/recipes' : '/api/rezepte';
|
||||
|
||||
@@ -119,6 +119,7 @@ export async function load({ fetch, params, url}) {
|
||||
const germanShortName = isEnglish ? (item.germanShortName || '') : item.short_name;
|
||||
|
||||
return {
|
||||
...data, // Include server load data (strippedName, strippedDescription)
|
||||
...item,
|
||||
isFavorite,
|
||||
multiplier,
|
||||
|
||||
Reference in New Issue
Block a user