Reputation: 737
I am creating nested pathname routes as in below image:
These URLs to access them work as expected:
/localhost/list/2020/prod/furn
/localhost/list/2020/prod/deco
/localhost/list/2021/prod/furn
These URLs also work, but it should not.
/localhost/list/blah/p/furn
/localhost/list/2020/xxx/deco
/localhost/list/furn
PS:If list
is removed from above URLs they don't work.
Sample URLs passed from svelte.config.js:
entries: ['/list/2020/prod/furn', '/list/2021/prod/deco']
Any clue how to achieve this to work as expected for static site generation is appreciated.
Upvotes: 0
Views: 228
Reputation: 29897
dec
, cat
, and act
are variables that are passed to your load functions and by default anything is allowed.
For static site generation you don't have to do anything, just don't link to invalid urls.
But I'd recommend to add validation logic in the load function:
When you encounter an invalid value respond with a error status like { status: 404 }
Adding validation could break the svelte-kit build
but you'd get useful errors like:
> 404 /list/blah/p/furn (linked from /)
Upvotes: 1