Skip to content

Commit

Permalink
fix: for SSR Compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
JuckZ committed Oct 30, 2023
1 parent 50fb905 commit 07c6dd1
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { h, watchEffect, onMounted } from 'vue'
import Theme from 'vitepress/theme'
import Documate from '@documate/vue'
import '@documate/vue/dist/style.css'
import { docsearch } from "meilisearch-docsearch";
import "meilisearch-docsearch/css";
import './style.css'
import { type EnhanceAppContext, inBrowser, useData } from 'vitepress'
Expand All @@ -20,20 +19,28 @@ export default {
}
})
onMounted(() => {
docsearch({
container: "#docsearch",
host: "https://meilisearch-chaovee.koyeb.app",
apiKey: "d34c065c81456f05748bd58bd9b1719209c231d1cfe201777bd55f8c21da32d0",
indexUid: "abm",
});
// For SSR Compatibility https://vitepress.dev/guide/ssr-compat#ssr-compatibility
import('meilisearch-docsearch').then((docsearch) => {
docsearch.default({
container: "#docsearch",
host: "https://meilisearch-chaovee.koyeb.app",
apiKey: "d34c065c81456f05748bd58bd9b1719209c231d1cfe201777bd55f8c21da32d0",
indexUid: "abm",
translations: {
button: {},
modal: {}
}
});
})

})
},
Layout: () => {
return h(Theme.Layout, null, {
// https://vitepress.dev/guide/extending-default-theme#layout-slots
'nav-bar-content-before': () => h(
'span',
{ id: 'content-before'},
{ id: 'content-before' },
[
h(Documate, {
endpoint: 'https://f965a6vcks.us.aircode.run/ask',
Expand Down

0 comments on commit 07c6dd1

Please sign in to comment.