47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import path from 'path';
|
|
import type { LoadContext, Plugin } from '@docusaurus/types';
|
|
|
|
interface SearchPluginOptions {
|
|
providersModule: string;
|
|
}
|
|
|
|
export default function docuservixSearchPlugin(
|
|
_ctx: LoadContext,
|
|
options: SearchPluginOptions,
|
|
): Plugin {
|
|
return {
|
|
name: 'docuservix-search',
|
|
|
|
getThemePath() {
|
|
return path.resolve(__dirname, './theme');
|
|
},
|
|
|
|
getTypeScriptThemePath() {
|
|
return path.resolve(__dirname, './theme');
|
|
},
|
|
|
|
configureWebpack() {
|
|
return {
|
|
resolve: {
|
|
alias: {
|
|
'@docuservix-search/config': options.providersModule,
|
|
},
|
|
},
|
|
};
|
|
},
|
|
|
|
async contentLoaded({ actions }) {
|
|
actions.addRoute({
|
|
path: '/search',
|
|
component: '@theme/SearchPage',
|
|
exact: true,
|
|
});
|
|
actions.addRoute({
|
|
path: '/chat-x',
|
|
component: '@theme/ChatPage',
|
|
exact: true,
|
|
});
|
|
},
|
|
};
|
|
}
|