最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

url routing - SvelteKit Duplicate Routes in Layout Groups - Stack Overflow

programmeradmin0浏览0评论

Is it possible to have the same route be on different layout groups in SvelteKit. I want to have two different layout groups "/(private)/(app)" and "/(public)/(landing)" that define the routes for my authenticated and not authenticated pages. Normally I can do this in NGINX by making an auth subrequest. But in SvelteKit I get the following error:

The "/(private)/(app)" and "/(public)/(landing)" routes conflict with each other

Can we define this in the hooks.server.ts file or maybe the root layout.server.ts?

Is it possible to have the same route be on different layout groups in SvelteKit. I want to have two different layout groups "/(private)/(app)" and "/(public)/(landing)" that define the routes for my authenticated and not authenticated pages. Normally I can do this in NGINX by making an auth subrequest. But in SvelteKit I get the following error:

The "/(private)/(app)" and "/(public)/(landing)" routes conflict with each other

Can we define this in the hooks.server.ts file or maybe the root layout.server.ts?

Share Improve this question asked yesterday Rey Christian EustaquioRey Christian Eustaquio 212 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I do not think this is currently possible.

Recently an issue has been opened about a similar problem. As noted there, this would be a use case for the reroute hook, but it currently has a cacheability requirement (which will not work if the deciding factor is the authentication status of the user).

With reroute, you can keep the URL as is but return a specific route, so you could turn the groups into regular path segments which will not be visible but help disambiguate the routing.

发布评论

评论列表(0)

  1. 暂无评论