Skip to content

Commit

Permalink
feat: use algolia search (#999)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunchanglong authored Jun 6, 2024
1 parent 1509d61 commit 7986252
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
10 changes: 1 addition & 9 deletions docs/.vitepress/config/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,7 @@ const common = async () => {
themeConfig: {
latestVersion: LATEST_VERSION,
search: {
provider: 'local',
options: {
_render(src, env, md) {
const html = md.render(src, env)
// excludes internal document dictionary
if (env.relativePath.includes('db-cloud-shared')) return ''
return html
}
}
provider: 'algolia',
},
siteTitle: '',
sidebar: {
Expand Down
11 changes: 11 additions & 0 deletions docs/.vitepress/config/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ export const enConfig = async () => ({
zh: { label: '简体中文', lang: 'zh-CN', link: `${websiteMap['zh']}${base}` },
},
themeConfig: {
search: {
options: {
appId: 'SRGB68Y6CW',
apiKey: 'eacb3d367f08bb200e8dbfc2470984d8',
indexName: 'greptime',
searchParameters: {
facetFilters: [`version:${CURRENT_VERSION}`],
},
maxResultsPerGroup: 7,
},
},
notFound: {
quote: 'Unfortunately, the content you are looking for is not found.',
linkText: 'Take me to homepage',
Expand Down
7 changes: 7 additions & 0 deletions docs/.vitepress/config/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ export const zhConfig = async () => ({
},
search: {
options: {
appId: 'SCVT6GSUZV',
apiKey: '450bf5e5a3c1ecd3c4154530e25678c5',
indexName: 'greptime',
searchParameters: {
facetFilters: [`version:${CURRENT_VERSION}`]
},
maxResultsPerGroup: 7,
locales: {
root: {
translations: {
Expand Down
6 changes: 3 additions & 3 deletions docs/.vitepress/theme/style/search.styl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
color var(--color-dark-primary) !important
.VPNavBarSearch
margin 0 12px
#local-search .DocSearch-Button
#docsearch .DocSearch-Button
height 38px
border-radius var(--border-radius-s)
background var(--color-light-primary-2)
Expand All @@ -46,14 +46,14 @@
border-right none

@media(max-width 767px)
.VPNavBarSearch #local-search .DocSearch-Button
.VPNavBarSearch #docsearch .DocSearch-Button
background transparent
.DocSearch-Button-Container
width 22px
height 22px
display flex
justify-content center
#local-search
#docsearch
// TODO
&:hover .DocSearch-Button .DocSearch-Button-Container
background var(--color-light-primary-2)
Expand Down

0 comments on commit 7986252

Please sign in to comment.