Skip to content

Commit

Permalink
Support linking to any relative docs page (ex. /customization)
Browse files Browse the repository at this point in the history
  • Loading branch information
techniq committed Aug 19, 2023
1 parent 70caaab commit 1141798
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/routes/docs/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import ViewSourceButton from '$docs/ViewSourceButton.svelte';
import { xlScreen } from '$lib/stores/matchMedia';
import { cls } from '$lib/utils/styles';
import { toTitleCase } from '$lib/utils/string';
$: [path, type, name] = $page.url.pathname.match('.*/(.*)/(.*)') ?? [];
$: title = $page.data.meta?.title ?? name;
Expand Down Expand Up @@ -59,6 +60,8 @@
} else {
return { type: 'website', name: url, url };
}
} else if (r.startsWith('/')) {
return { type: 'docs', name: toTitleCase(r.slice(1)), url: r };
} else {
const [type, name] = r.split('/');
return { type, name, url: `/docs/${type}/${name}` };
Expand Down
4 changes: 3 additions & 1 deletion src/routes/docs/components/Theme/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export async function load() {
api,
source,
pageSource,
description: 'Create theme context as component. Typically `createTheme()` is used directly',
description:
'Create theme context as a component. Useful to scope theme within a component tree, although typically `createTheme()` is used directly',
related: ['/customization'],
},
};
}

1 comment on commit 1141798

@vercel
Copy link

@vercel vercel bot commented on 1141798 Aug 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.