Open markotarnaj opened 4 years ago
Another use case: Dynamically creating routes with a headless CMS. In my case, a page with the slug index
is treated like index/index.svelte
and the index route becomes unavailable.
The fact that an empty index.svelte
file fixes the whole thing makes that not a proposal, but a bug that needs to be fixed. In my humble opinion.
Unfortunately, I am not smart enough to make a PR.
Edit: Well, my empty index.svelte
is entirely ignored resulting in a 404 error as always. Is there a workaround for dynamic pages created using a [slug].svelte
file?
I encountered the same problem now. I have a page titled “Index” and it should be accessible via an /index
route. So I created a routes/index/
directory containing an index.svelte
file—works. But now routes/index.svelte
became unavailable.
Has anybody found a workaround? I would really like to refrain from renaming the route. The page has the title “Index” and should be reachable with that URL.
New project, same problem. The solution for the last project was a language identifier at the base of each route (e. g. en/index
), which needed to be added anyways and made it eventually work.
This got me thinking:
routes
├── [route(index)]
| └── index.svelte
├── _error.svelte
├── _layout.svelte
└── index.svelte
Using a route with a dynamic parameter that only matches index
(using a regular expression) seems to work as expected.
Description
According to documentation:
It is reasonable to assume that
src/routes/index/index.svelte
would be treated the same assrc/routes/index.svelte
. So I created the following structure:which results in a 404 on index. As a workaround I simply added an empty
index.svelte
file inside/routes
, and that fixed everything:For some reason it doesn't load the empty
routes/index.svelte
, but it loads theroutes/index/index.svelte
which seems counter-intuitive.Logs
Expected behavior
Treat
src/routes/index/index.svelte
same assrc/routes/index.svelte
.Version info: