Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanc1 committed Oct 24, 2024
1 parent 83a9310 commit 8da5b4c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/common/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function getProjectHeadings(
},
...project.pages.map((p) => {
if (!('slug' in p)) return p;
const slug = p.slug?.replaceAll('.', '/');
const slug = p.slug?.replace(/\.index$/, '').replaceAll('.', '/');
return {
...p,
path: projectSlug && project.slug ? `/${project.slug}/${slug}` : `/${slug}`,
Expand Down
2 changes: 1 addition & 1 deletion themes/book/app/utils/loaders.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export async function getPage(
throw redirect(projectName ? `/${projectName}` : '/');
}
if (opts.slug?.endsWith('.index') && opts.redirect) {
const newSlug = opts.slug.slice(0, -6);
const newSlug = opts.slug.replace(/\.index$/, '').replace(/\./g, '/');
throw redirect(projectName ? `/${projectName}/${newSlug}` : `/${newSlug}`);
}
let slug = opts.loadIndexPage || opts.slug == null ? project.index : opts.slug;
Expand Down

0 comments on commit 8da5b4c

Please sign in to comment.