fix(search): avoid double base

pull/2224/head
Divyansh Singh 2 years ago
parent 77db39be2e
commit 25a1fe90bd

@ -260,7 +260,7 @@ const router = useRouter()
onKeyStroke('Enter', () => {
const selectedPackage = results.value[selectedIndex.value]
if (selectedPackage) {
router.go(withBase(selectedPackage.id))
router.go(selectedPackage.id)
emit('close')
}
})
@ -391,7 +391,7 @@ useEventListener('popstate', (event) => {
<a
v-for="(p, index) in results"
:key="p.id"
:href="withBase(p.id)"
:href="p.id"
class="result"
:class="{
selected: selectedIndex === index

@ -97,7 +97,7 @@ export async function localSearchPlugin(
function getDocId(file: string) {
let relFile = path.relative(siteConfig.srcDir, file)
relFile = siteConfig.rewrites.map[relFile] || relFile
let id = path.join(siteConfig.userConfig.base ?? '', relFile)
let id = path.join(siteConfig.userConfig.base ?? '/', relFile)
id = id.replace(/\.md$/, siteConfig.cleanUrls ? '' : '.html')
return id
}

Loading…
Cancel
Save