🚨 Disclaimer: Routify 3 is currently in Release Candidate stage.
Please be aware that while the documentation is comprehensive, it may contain inaccuracies or errors. The codebase is also subject to changes that could affect functionality. We appreciate your understanding and welcome any feedback or contributions.
guide
Introduction
Modules
Formerly known as layouts
Modules are nodes that can control logic, layout and access for descendent nodes.
Modules are created as _module.svelte
.
<!-- _module.svelte -->
<slot>
<!-- pages in this folder and subfolders
will be rendered here -->
</slot>
<p>Copyright my website </p>
Passing props
Props can be passed to child modules and pages with props
:
<slot props={{myMsg: "Hello World!"}} />
Consuming props
Props can be consumed in all descendent nodes.
// Child node
export let myMsg
console.log(myMsg)
// Descendent node
/** @type {RoutifyContext} */
export let context
console.log(context.allProps.myMsg)
Disabling parent modules
Sometimes we may need to disable one or more parent modules. To do this we can use the reset
meta helper.
Remove all parent modules
<!-- routify:meta reset -->
Remove the two nearest parent modules
<!-- routify:meta reset=2 -->