Skip to content

Commit

Permalink
fix: handle trailing slash
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed Jan 28, 2023
1 parent 06a3c0d commit c23206c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/client/app/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ export function createRouter(

if (inBrowser) {
nextTick(() => {
let actualPathname = `/${__pageData.relativePath.replace(
/(?:(^|\/)index)?\.md$/,
'$1'
)}`
if (actualPathname !== targetLoc.pathname) {
targetLoc.pathname = actualPathname
history.replaceState(null, '', targetLoc)
}

if (targetLoc.hash && !scrollPosition) {
let target: HTMLElement | null = null
try {
Expand Down

0 comments on commit c23206c

Please sign in to comment.