Skip to content

Commit

Permalink
fix: don't remove relative part from url during normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed Sep 10, 2022
1 parent 2509ab9 commit ad8a368
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/client/theme-default/support/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ export function normalizeLink(url: string): string {
const normalizedPath =
pathname.endsWith('/') || pathname.endsWith('.html')
? url
: `${pathname.replace(
/(\.md)?$/,
site.value.cleanUrls === 'disabled' ? '.html' : ''
)}${search}${hash}`
: url.replace(
/(?:(^\.+)\/)?.*$/,
`$1${pathname.replace(
/(\.md)?$/,
site.value.cleanUrls === 'disabled' ? '.html' : ''
)}${search}${hash}`
)

return withBase(normalizedPath)
}

0 comments on commit ad8a368

Please sign in to comment.