Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Custom 404 Error Pages in SvelteKit Not Rendering as Expected Based on Folder Structure

$
0
0

I'm building an application using SvelteKit and I want to create custom error pages that are specific to different parts of my application based on their folder structure. My understanding is that SvelteKit should allow me to have +error.svelte files in different folders, and any 404 errors encountered within those folders should trigger the nearest +error.svelte file.

However, this doesn't seem to be working as expected.

My current file structure looks like this:

+error.svelte(app)/+page.svelte(app)/+error.sveltedashboard/+page.sveltedashboard/+error.svelte

When I navigate to a non-existent page like dashboard/blbla, instead of rendering the +error.svelte inside the dashboard folder, it always falls back to the root +error.svelte file.

How can I configure SvelteKit to render the closest +error.svelte file within the relevant folder when a 404 error occurs? Is there something I'm missing in my setup?

I took a look at How to add a custom 404 page and a different Error page (for other errors) in SvelteKit?

But that does not work for me. Am i missing something?


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>