diff --git a/docs-svelte-kit/src/lib/utils.js b/docs-svelte-kit/src/lib/utils.js index 8eecc14e2..9c58a6db2 100644 --- a/docs-svelte-kit/src/lib/utils.js +++ b/docs-svelte-kit/src/lib/utils.js @@ -69,7 +69,8 @@ export function markdownPath(path) { // eslint-disable-next-line no-param-reassign -- ignore path = stripBaseUrl(path) - let normalized = path === "/" ? "README" : path.replace(/^\/|\/$/g, "") + let normalized = + !path.trim() || path === "/" ? "README" : path.replace(/^\/|\/$/g, "") return `${normalized}.md` } @@ -95,10 +96,9 @@ export const menuItems = readable([], function start(set) { function generateMenu($page, toc) { const result = [] - const [, menus] = - Object.entries(SIDE_MENU).find(([k]) => - stripBaseUrl($page.url.pathname).startsWith(k), - ) || SIDE_MENU["/"] + const [, menus] = Object.entries(SIDE_MENU).find(([k]) => + stripBaseUrl($page.url.pathname).startsWith(k), + ) || ["/", SIDE_MENU["/"]] for (const { path, title, children } of menus) { const active = isActive(path, $page) if (active) { diff --git a/package.json b/package.json index 46c6c08b7..d79d8689f 100644 --- a/package.json +++ b/package.json @@ -76,8 +76,8 @@ "@ota-meshi/eslint-plugin": "^0.10.0", "@ota-meshi/eslint-plugin-svelte": "^0.26.0", "@sindresorhus/slugify": "^2.1.0", - "@sveltejs/adapter-static": "^1.0.0-next.21", - "@sveltejs/kit": "^1.0.0-next.201", + "@sveltejs/adapter-static": "^1.0.0-next.26", + "@sveltejs/kit": "^1.0.0-next.240", "@types/eslint": "^8.0.0", "@types/eslint-scope": "^3.7.0", "@types/eslint-visitor-keys": "^1.0.0", diff --git a/svelte.config.esm.mjs b/svelte.config.esm.mjs index 577dae5f7..4cf11f65e 100644 --- a/svelte.config.esm.mjs +++ b/svelte.config.esm.mjs @@ -40,7 +40,7 @@ const config = { assets: path.join(dirname, "./docs-svelte-kit/statics"), }, - trailingSlash: "always", + // trailingSlash: "always", vite: { server: {