From 0197191f023af839e7aff956a67ffb5f93d724cc Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Sat, 27 Dec 2025 14:14:29 +0100 Subject: [PATCH] add custom error page for recipe route with German fallback option When an English recipe is not found, the error page now checks if a German version exists and offers options to view it or edit/translate (if logged in). --- .../[name]/+error.svelte | 390 ++++++++++++++++++ 1 file changed, 390 insertions(+) create mode 100644 src/routes/[recipeLang=recipeLang]/[name]/+error.svelte diff --git a/src/routes/[recipeLang=recipeLang]/[name]/+error.svelte b/src/routes/[recipeLang=recipeLang]/[name]/+error.svelte new file mode 100644 index 0000000..58b76fe --- /dev/null +++ b/src/routes/[recipeLang=recipeLang]/[name]/+error.svelte @@ -0,0 +1,390 @@ + + + + {getErrorTitle(status)} - Alexander's Website + + +
+
+
+ {getErrorIcon(status)} +
+ +

+ {getErrorTitle(status)} +

+ +
+ Error {status} +
+ +

+ {getErrorDescription(status)} +

+ + {#if error?.message && !checkingGermanRecipe} +
+ {error.message} +
+ {/if} + + {#if checkingGermanRecipe} +
+ Checking for German version... +
+ {/if} + +
+ {#if status === 401} + + + {:else if status === 404 && recipeLang === 'recipes' && germanRecipeExists && !checkingGermanRecipe} + + + {#if user} + + {/if} + + {:else if status === 404} + + + {:else if status === 403} + + + {:else if status === 500} + + + {:else} + + + {/if} +
+
+
+ +