Skip to content

Commit

Permalink
Merge pull request #28 from gogf/feat/search
Browse files Browse the repository at this point in the history
feat: 使用algolia搜索
  • Loading branch information
gqcn authored Nov 6, 2024
2 parents c891da9 + 8ddeabf commit e2637e2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 228 deletions.
40 changes: 30 additions & 10 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,6 @@ const config: Config = {
],
],
plugins: [
// 搜索
[
require.resolve('@cmfcmf/docusaurus-search-local'),
{
// Options here
// language of your documentation, see next section
language: 'zh',
},
],
],
themeConfig: {
colorMode: {
Expand Down Expand Up @@ -160,6 +151,11 @@ const config: Config = {
position: 'right',
label: '问题反馈',
},
{
href: 'https://wiki.goframe.org/',
position: 'right',
label: '返回旧版',
},
{
href: 'https://github.com/gogf/gf',
position: 'right',
Expand All @@ -183,6 +179,30 @@ const config: Config = {
additionalLanguages: ['bash', 'javascript', 'yaml', 'ini', 'json'], // 添加语言
// 默认支持的语言 https://github.com/FormidableLabs/prism-react-renderer/blob/master/packages/generate-prism-languages/index.ts#L9-L23
},
// 搜索配置
algolia: {
// The application ID provided by Algolia
appId: 'ZQUL8VI47R',

// Public API key: it is safe to commit it
apiKey: '35fbd44a6d7dfae18587c435bc6a0d01',

indexName: 'goframe',

// Optional: see doc section below
contextualSearch: true,

// Optional: Algolia search parameters
searchParameters: {},

// Optional: path for search page that enabled by default (`false` to disable it)
searchPagePath: 'search',

// Optional: whether the insights feature is enabled or not on Docsearch (`false` by default)
insights: false,

//... other Algolia params
},
} satisfies Preset.ThemeConfig,
scripts: [
{
Expand All @@ -192,4 +212,4 @@ const config: Config = {
],
};

export default config;
export default config;
211 changes: 0 additions & 211 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"typecheck": "tsc"
},
"dependencies": {
"@cmfcmf/docusaurus-search-local": "^1.1.0",
"@docusaurus/core": "^3.6.0",
"@docusaurus/plugin-content-docs": "^3.6.0",
"@docusaurus/preset-classic": "^3.6.0",
Expand All @@ -29,11 +28,6 @@
"react-dom": "^18.0.0",
"sharp": "^0.33.5"
},
"overrides": {
"@cmfcmf/docusaurus-search-local": {
"@docusaurus/core": "^3.1.0"
}
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.6.0",
"@docusaurus/tsconfig": "3.1.1",
Expand All @@ -55,4 +49,4 @@
"engines": {
"node": ">=18.0"
}
}
}

0 comments on commit e2637e2

Please sign in to comment.