
Product
Introducing Webhook Events for Pull Request Scans
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
docusaurus-plugin-search-glean
Advanced tools
A Docusarus plugin to integrate Glean search into your Docusaurus site.
This plugin utilizes Glean's SDK to enable both Glean search and AI Agent chat into your documentation. It is a drop-in replacement for the default Docusaurus search plugin.
Enables you to integrate Glean's search into your Docusaurus site.
Enables you to integrate Glean's AI Agent chat into your Docusaurus site (requires setting up an AI Agent in Glean).
npm install docusaurus-plugin-search-glean
or
yarn add docusaurus-plugin-search-glean
The search feature integrates Glean's search functionality into your Docusaurus site. You can configure search independently of the chat feature.
Add the plugin to your docusaurus.config.js
with search options:
module.exports = {
// ...
plugins: [
[
require.resolve('docusaurus-plugin-search-glean'),
{
searchOptions: {
// Search configuration options
},
},
],
],
};
If your documentation doesn't change often, use statically configured search options:
module.exports = {
// ...
plugins: [
[
require.resolve('docusaurus-plugin-search-glean'),
{
searchOptions: {
filters: [
{ key: 'app', value: 'github' },
{ key: 'type', value: 'page' },
{ key: 'repository', value: '<your repository name>' },
],
},
},
],
],
};
Any changes to the docusaurus site will be automatically picked up by Glean and the search content will be updated accordingly.
If your documentation changes often, utilize Glean collections to dynamically configure search. While this approach is more complex, it ensures that the search configuration is always up-to-date with the current state of your documentation.
To achieve this, you will need to create a Glean collection for your documentation:
Example configuration:
docusaurus.config.js
:
module.exports = {
// ...
plugins: [
[
require.resolve('docusaurus-plugin-search-glean'),
{
searchOptions: {
filters: [{ key: 'collection', value: '<collection name>' }],
},
},
],
],
};
glean-collections-sync.yml
:
name: Sync Collections
on:
schedule:
- cron: '0 0 * * *' # Runs every day at midnight UTC
workflow_dispatch: # Allows for manual triggering
jobs:
sync_collections:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Sync collections
uses: scalvert/glean-collections-sync@v1
with:
glean-client-api-url: ${{ secrets.GLEAN_CLIENT_API_URL }}
glean-client-api-token: ${{ secrets.GLEAN_CLIENT_API_TOKEN }}
glean-user-email: ${{ secrets.GLEAN_USER_EMAIL }}
collection-sync-configs: '[{"name": "<collection name>", "query": "<collection query>", "filters": "<collection filters>"}]'
The chat feature integrates Glean's AI Agent chat into your Docusaurus site. You can configure chat independently of the search feature.
Add the plugin to your docusaurus.config.js
with chat options:
module.exports = {
// ...
plugins: [
[
require.resolve('docusaurus-plugin-search-glean'),
{
chatOptions: {
agentId: 'your-glean-agent-id',
},
},
],
],
};
Note: The
agentId
property replaces the legacyapplicationId
property. WhileapplicationId
is still supported for backward compatibility, it will be deprecated in the future. We recommend usingagentId
for new implementations.
If your documentation doesn't change often, use statically configured chat options:
module.exports = {
// ...
plugins: [
[
require.resolve('docusaurus-plugin-search-glean'),
{
chatOptions: {
agentId: 'your-glean-agent-id',
},
},
],
],
};
Note: Changes to the site will not automatically update the knowledge sources for the Glean Agent - those changes must be made manually in Glean.
For frequently changing documentation, use Glean collections to configure chat. The Agent's Knowledge Sources should be configured to use the collection.
Example configuration:
docusaurus.config.js
:
module.exports = {
// ...
plugins: [
[
require.resolve('docusaurus-plugin-search-glean'),
{
chatOptions: {
agentId: 'your-glean-agent-id', // The Agent's Knowledge Sources should be configured to use the collection
},
},
],
],
};
Follow the same collections sync setup as described in the Dynamic Search Configuration section.
When the chat feature is enabled, the plugin automatically creates a dedicated chat page (default path: /chat
). However, the plugin does not automatically add navigation links. You need to manually add navigation elements to help users discover and access the chat functionality.
Add a link to the chat page in your site's navigation bar by updating the navbar.items
array in docusaurus.config.js
:
module.exports = {
// ...
themeConfig: {
navbar: {
items: [
// ... your existing navbar items
{
label: 'Chat',
to: '/chat', // Use the same path as your chatPagePath option
position: 'right',
},
],
},
},
};
If you prefer to add the chat link to a sidebar, you can include it in your sidebar configuration:
// sidebars.js
module.exports = {
tutorialSidebar: [
// ... your existing sidebar items
{
type: 'link',
label: 'Chat',
href: '/chat', // Use the same path as your chatPagePath option
},
],
};
If you've configured a custom chatPagePath
in your plugin options, make sure to use the same path in your navigation links:
// Plugin configuration
([
require.resolve('docusaurus-plugin-search-glean'),
{
chatPagePath: 'ai-assistant', // Custom path
chatOptions: {
agentId: 'your-glean-agent-id',
},
},
],
// Navbar link should match
{
label: 'AI Assistant',
to: '/ai-assistant', // Match your custom chatPagePath
position: 'right',
});
You can enable both search and chat features simultaneously by providing both searchOptions
and chatOptions
:
module.exports = {
// ...
plugins: [
[
require.resolve('docusaurus-plugin-search-glean'),
{
searchOptions: {
filters: [
{ key: 'app', value: 'github' },
{ key: 'type', value: 'page' },
{ key: 'repository', value: '<your repository name>' },
],
},
chatOptions: {
agentId: 'your-glean-agent-id',
},
},
],
],
};
Property | Type | Description |
---|---|---|
searchOptions | Partial<ModalSearchOptions> | false | Options for search functionality. Pass false to disable. |
chatOptions | Partial<ChatOptions> | false | Options for chat functionality. Pass false to disable. |
chatPagePath | string | Path to the chat page within the application. |
enableAnonymousAuth | boolean | If true, the plugin will fetch guest authentication tokens automatically. |
For more information on the search and chat options, refer to the Glean documentation.
v0.7.0 (2025-07-17)
FAQs
A Docusaurus plugin for Glean modal search
We found that docusaurus-plugin-search-glean demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.