Not sure if this is on SvelteKit since there is an open issue for this but there is a weird error issue with nested routes. We created a blog and we are simply at this point just listing out the links in the index but unfortunately, we are getting this error Error: 404 /blog/blog/test-post (linked from /blog/test-post).
when commented out everything works fine
I would guess it is because a trailing slash is missing at the very beginning of your dynamic link : href="/blog/{post.uid}" instead of href="blog/{post.uid}"
Unfortunately, I have tried that even adding a config in the svelte config to require a backslash but still no success. I had it working before but then the magic dissapeared.
I'll be honest I don't know anything about svelte, but from reading about sveltekit:prefetch:
prefetch(href) programmatically prefetches the given page, which means a) ensuring that the code for the page is loaded, and b) calling the page's load function with the appropriate options. This is the same behaviour that SvelteKit triggers when the user taps or mouses over an <a> element with sveltekit:prefetch. If the next navigation is to href , the values returned from load will be used, making navigation instantaneous. Returns a Promise that resolves when the prefetch is complete.
I'm guessing you'll need to pass the link resolver function for your link to be created correctly.
That was a possible solution I was looking into. For now, I decided to move from the static adapter to the netlify adapter and that is working just fine for now but I will take a look at this solution and report back.
1 Like
system
(system)
closed as resolved, flag & select 'Something Else' to reopen.
7
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.