docusaurus-search-local
docusaurus-search-local copied to clipboard
Does nothing on v3.1.0
Installed and configured according to docs. No search bar, no search index, the styles aren't even added to the CSS sheet. Here's the config:
(XXX denotes redacted)
import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
const config: Config = {
title: 'XXX Documentation',
tagline: "XXX Flagship Product Frontend",
favicon: 'img/favicon.ico',
// Set the production url of your site here
url: 'https://XXX.github.io/',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/',
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'XXX', // Usually your GitHub org/user name.
projectName: 'XXX', // Usually your repo name.
deploymentBranch: 'gh-pages',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
trailingSlash: true,
// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
presets: [
[
'@docusaurus/preset-classic',
{
docs: {
sidebarPath: './sidebars.ts',
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl:
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
},
theme: {
customCss: './src/css/custom.css',
},
} satisfies Preset.Options,
],
],
themeConfig: {
// Replace with your project's social card
image: 'img/docusaurus-social-card.jpg',
navbar: {
title: 'XXX Documentation',
logo: {
alt: 'XXX Logo',
src: 'img/XXX.png',
},
items: [
{
type: 'docSidebar',
sidebarId: 'gettingStartedSidebar',
position: 'left',
label: 'Getting Started',
},
{
type: 'docSidebar',
sidebarId: 'docsSidebar',
position: 'left',
label: 'Docs',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Areas',
items: [
{
label: 'Getting started',
to: '/docs/getting-started',
},
{
label: 'Docs',
to: '/docs/Development/contributing-guide/',
},
],
},
{
title: 'Community',
items: [
{
label: 'XXX Slack Channel',
href: 'XXX',
},
{
label: 'XXX Docs',
href: 'XXX',
},
],
},
{
title: 'More',
items: [
{
label: 'XXX Page',
to: 'XXX',
},
{
label: 'GitHub',
href: 'XXX',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} XXX, Inc. Built with Docusaurus.`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
themes: [
[
require.resolve("@easyops-cn/docusaurus-search-local"),
/** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */
{
hashed: true,
},
],
],
} satisfies Preset.ThemeConfig,
};
export default config;
What was your solution?
I (stupidly) had put the configuration at the wrong level of the configuration file. Totally on me.
Oh wow, so had I. Your comment just unblocked me. Thank you.
Wow, I actually accomplished something today. Glad to hear it!
I'm not seeing any index being generated with docosaurus 3.2.1
[INFO] [en] Creating an optimized production build...
search-local:info using @easyops-cn/docusaurus-search-local v0.40.1 +0ms
search-local:info the index hash is "df00ac10" +1ms
✔ Client
Compiled successfully in 10.63s
✔ Server
● Client █████████████████████████ cache (99%) shutdown IdleFileCachePlugin
stored
✔ Server
search-local:info gathering documents +16s
search-local:verbose loadedVersions: [
{
versionName: 'current',
label: 'Next',
banner: null,
badge: false,
noIndex: false,
className: 'docs-version-current',
path: '/docs',
tagsPath: '/docs/tags',
editUrl: 'https://github.com/signal-ai/data-platform-documentation/edit/main/docs',
editUrlLocalized: 'https://github.com/signal-ai/data-platform-documentation/edit/main/i18n/en/docusaurus-plugin-content-docs/current',
isLast: true,
routePriority: -1,
sidebarFilePath: '/home/charlie_briggs/projects/signal/data-ingestion-documentation/sidebars.ts',
contentPath: '/home/charlie_briggs/projects/signal/data-ingestion-documentation/docs',
contentPathLocalized: '/home/charlie_briggs/projects/signal/data-ingestion-documentation/i18n/en/docusaurus-plugin-content-docs/current',
docs: [
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object]
],
drafts: [],
sidebars: { root: [Array] }
}
] +0ms
search-local:verbose versionData: Map(1) {
'/home/charlie_briggs/projects/signal/data-ingestion-documentation/build' => Set(11) {
'/docs/content/article_ingestion_faq',
'/docs/content/canonical_and_original_sources',
'/docs/content/content_access_model',
'/docs/content/documents_articles_and_stories',
'/docs/content/reach_internal_user_guide',
'/docs/content/source_events',
'/docs/decisions/record-architecture-decisions',
'/docs/glossary',
'/docs/intro',
'/docs/proposals/add-website-analytics',
'/docs/tools/source_tool_user_guide'
}
} +1ms
search-local:info parsing documents +2ms
search-local:verbose parsing docs file 'build/docs/content/article_ingestion_faq/index.html' of '/docs/content/article_ingestion_faq' +0ms
search-local:verbose parsing docs file 'build/docs/content/canonical_and_original_sources/index.html' of '/docs/content/canonical_and_original_sources' +1ms
search-local:verbose parsing docs file 'build/docs/content/content_access_model/index.html' of '/docs/content/content_access_model' +0ms
search-local:verbose parsing docs file 'build/docs/content/documents_articles_and_stories/index.html' of '/docs/content/documents_articles_and_stories' +0ms
search-local:verbose parsing docs file 'build/docs/content/reach_internal_user_guide/index.html' of '/docs/content/reach_internal_user_guide' +0ms
search-local:verbose parsing docs file 'build/docs/content/source_events/index.html' of '/docs/content/source_events' +0ms
search-local:verbose parsing docs file 'build/docs/decisions/record-architecture-decisions/index.html' of '/docs/decisions/record-architecture-decisions' +0ms
search-local:verbose parsing docs file 'build/docs/glossary/index.html' of '/docs/glossary' +1ms
search-local:verbose parsing docs file 'build/docs/intro/index.html' of '/docs/intro' +0ms
search-local:verbose parsing docs file 'build/docs/proposals/add-website-analytics/index.html' of '/docs/proposals/add-website-analytics' +0ms
search-local:verbose parsing docs file 'build/docs/tools/source_tool_user_guide/index.html' of '/docs/tools/source_tool_user_guide' +0ms
search-local:info building index +60ms
search-local:info writing index (/) to disk +1ms
search-local:info index (/) written to disk successfully! +5ms
[SUCCESS] Generated static files in "build".
[INFO] Use `npm run serve` command to test your build locally.
The built search index is empty:
[{"documents":[],"index":{"version":"2.3.9","fields":["t"],"fieldVectors":[],"invertedIndex":[],"pipeline":["stemmer"]}},{"documents":[],"index":{"version":"2.3.9","fields":["t"],"fieldVectors":[],"invertedIndex":[],"pipeline":["stemmer"]}},{"documents":[],"index":{"version":"2.3.9","fields":["t"],"fieldVectors":[],"invertedIndex":[],"pipeline":["stemmer"]}}]
My mistake was that I had set noIndex: true
which I didn't realise search-local would respect - this prevented any pages being indexed.
Setting forceIgnoreNoIndex: true
on the search local plugin fixed this for me.