Skip to content

Instantly share code, notes, and snippets.

@Theo-Steiner
Last active January 23, 2022 08:54
Show Gist options
  • Save Theo-Steiner/70c2cd0839c281bd3759a35625582376 to your computer and use it in GitHub Desktop.
Save Theo-Steiner/70c2cd0839c281bd3759a35625582376 to your computer and use it in GitHub Desktop.
Show page at a different route than its original route
How to show a route 'a' at route 'b' even with running the module script.
<!-- src/routes/a.svelte -->
<script context="module">
export async function load({page}) {
return {
props: {
path: page.path
}
}
}
</script>
<script>
export let path;
</script>
<h1>Hello from page A, currently at path: {path}</h1>
<!-- src/routes/b.svelte -->
<script context="module">
import A, { load } from "./a.svelte";
export { load }
</script>
<A ...{$$props} />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment