Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix search
  • Loading branch information
Nityam573 committed Aug 21, 2025
commit f7f9b8d29deb49fbdbf8acf8dd080774a06151d6
14 changes: 4 additions & 10 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,7 @@ module.exports = {
defaultLanguage: "javascript",
additionalLanguages: ["solidity"],
},
algolia: {
// need to update this
indexName: "privado",
appId: process.env.ALGOLIA_APP_ID,
apiKey: process.env.ALGOLIA_API_KEY,
contextualSearch: true,
algoliaOptions: {
attributesToSnippet: ["content:20"],
},
},
// Algolia search replaced with Pagefind
navbar: {
hideOnScroll: true,
logo: {
Expand Down Expand Up @@ -197,6 +188,9 @@ module.exports = {
crossorigin: "anonymous",
},
],
plugins: [
'./plugins/pagefind-plugin.js',
],
presets: [
[
"@docusaurus/preset-classic",
Expand Down
102 changes: 84 additions & 18 deletions package-lock.json

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

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"private": true,
"scripts": {
"build": "docusaurus build",
"build:pagefind": "pagefind --site build --output-path build/pagefind",
"clear": "docusaurus clear",
"deploy": "docusaurus deploy",
"format": "prettier --write .",
Expand All @@ -15,6 +16,7 @@
"dependencies": {
"@docusaurus/core": "^2.4.3",
"@docusaurus/preset-classic": "^2.4.3",

"browserslist": "^4.22.2",
"classnames": "^2.3.2",
"docusaurus": "^1.14.7",
Expand All @@ -27,6 +29,9 @@
"react-gtm-module": "^2.0.11",
"rehype-katex": "^5.0.0",
"remark-math": "^3.0.0"
},
"devDependencies": {
"pagefind": "^1.0.0"
},
"browserslist": {
"production": [
Expand Down
23 changes: 23 additions & 0 deletions plugins/pagefind-plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const path = require('path');
const { execSync } = require('child_process');

module.exports = function(context, options) {
return {
name: 'pagefind-plugin',
async postBuild({ siteDir, routesPaths, outDir }) {
try {
console.log('Building Pagefind index...');

execSync(`npx pagefind --site "${outDir}" --output-path "${outDir}/pagefind"`, {
stdio: 'inherit',
cwd: siteDir,
});

console.log('Pagefind index built successfully!');
} catch (error) {
console.error('Error building Pagefind index:', error);
throw error;
}
},
};
};
Loading