Scheme/structure
File to URL mapping
In Routify, files in src/pages
correspond to URLs.
index.svelte
files corresponds to both /
and /index
Parameters
src/pages/admin/[business].svelte
corresponds to /admin/:business
, where :business is a parameter.
Excluding files
Files and directories prefixed with an underscore will not be picked up by Routify. (except for _layout.svelte
and _reset.svelte
)
Layouts and resets
Layout files are named _layout.svelte
and apply to all adjacent and nested Svelte files. A file can have multiple layouts if multiple layouts are recursively present in parent folders.
Reset files are named _reset.svelte
. They function like layout files but do not inherit the parent scope (layouts, props, etc.).
404 and fallbacks
404s can be caught with _fallback.svelte
. The first _fallback.svelte
that's found while traversing back through parent folders will be used.
Fallback inherits layout. In certain cases, the style position:fixed
is useful for a fullscreen fallback.
By default Routify watches .svelte
, .html
and .md
files. This can be changed in the config.
Please note that Routify doesn't parse markdown files.
Writing good documentation that is up-to-date is difficult. If you notice a mistake, help us out.