Skip to content

Commit

Permalink
feat: allow root docs pages (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainCodeman authored Sep 16, 2023
1 parent 8d4fd42 commit a47f14c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/kit-docs/src/lib/loaders/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ export async function loadKitDocsSidebar(
): Promise<ResolvedSidebarConfig | null> {
const matchedPath = matchSidebarPath(event.url, path);

if (!matchedPath) return null;
if (matchedPath === null) return null;

try {
const res = await event.fetch(`${base}/kit-docs/${slugToRequestParam(matchedPath)}.sidebar`);
const res = await event.fetch(`${base}/kit-docs/${matchedPath === '' ? 'index' : slugToRequestParam(matchedPath)}.sidebar`);
return res.json();
} catch (e) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion packages/kit-docs/src/node/handlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export async function handleSidebarRequest(
exts.length > 1 ? `.{${exts.map((ext) => ext.replace(/^\./, '')).join(',')}}` : exts[0];

const directory = paramToDir(dirParam);
const dirPath = path.resolve(ROUTES_DIR, directory);
const dirPath = path.resolve(ROUTES_DIR, directory === 'index' ? '' : directory);

const filePaths = sortOrderedFiles(readDirDeepSync(dirPath));

Expand Down

0 comments on commit a47f14c

Please sign in to comment.