diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte new file mode 100644 index 0000000..ba65186 --- /dev/null +++ b/src/routes/+error.svelte @@ -0,0 +1,5 @@ + diff --git a/src/routes/directory/[slug]/+page.ts b/src/routes/directory/[slug]/+page.ts index 10fc98d..8724bcc 100644 --- a/src/routes/directory/[slug]/+page.ts +++ b/src/routes/directory/[slug]/+page.ts @@ -21,6 +21,11 @@ export const load = (async ({ params }) => { } }); + // If SVGs array is empty, category can't exist + if (svgsByCategory.length === 0) { + return error(404, 'Not found'); + } + return { category: slug as string, svgs: svgsByCategory