Skip to content

Commit

Permalink
Merge pull request #66 from mimisavage/Add-a-search-engine,
Browse files Browse the repository at this point in the history
feat(config): add Algolia search configuration to docusaurus.config.js
  • Loading branch information
metalboyrick authored Dec 24, 2024
2 parents e29ac0c + f77fe00 commit b8b9175
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
APP_ID=
API_KEY=
INDEX_NAME=
17 changes: 17 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion

const dotenv = require('dotenv'); // Import dotenv
dotenv.config(); // Load environment variables

const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");

Expand Down Expand Up @@ -129,6 +132,20 @@ const config = {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
algolia: {
appId: process.env.APP_ID,
apiKey: process.env.API_KEY,
indexName: process.env.INDEX_NAME,
contextualSearch: true,
externalUrlRegex: "external\\.com|domain\\.com",
replaceSearchResultPathname: {
from: "/docs/",
to: "/",
},
searchParameters: {},
searchPagePath: "search",
insights: false,
},
}),
};

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@docusaurus/preset-classic": "2.4.0",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.1",
"dotenv": "^16.4.7",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2"
Expand Down

0 comments on commit b8b9175

Please sign in to comment.