Skip to content

Commit

Permalink
implement and test suggested change (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
diericx authored Aug 15, 2024
1 parent 641c3b0 commit 39ea15e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib/components/Breadcrumbs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@
let completeUrl = "";
let completeRoute =
relPathToRoutes + (relPathToRoutes.slice(-1) == "/" ? "" : "/");
const routes = routeId.split("/").filter((p) => p != "");
// Split the route ID on every forward slash, but if there is a group route include that in the
// following route. This accounts for the fact that (group) routes do not show up in the path.
// For Example:
// routeId: test/(group1)/test2/test3
// routes: ["test", "(group1)/test2", "test3"]
const routes = routeId.split(/(?<!\))\//).filter((p) => p != "");
const paths = url.pathname.split("/").filter((p) => p != "");
// Loop over each directory in the path and generate a crumb
Expand Down
9 changes: 9 additions & 0 deletions src/routes/(group)/groupedRoute/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script context="module" lang="ts">
// You can set the page title with a function that will be given
// data from the component in the layout
export function getPageTitle(pageData: any) {
return "Grouped Page";
}
</script>

Pages within grouped routes can set a page title.
1 change: 1 addition & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
<li>
<a href="/pageDataExample/metadataExample">Crumb Metadata Example</a>
</li>
<li><a href="/groupedRoute">Route Groups Example</a></li>
</ul>

0 comments on commit 39ea15e

Please sign in to comment.