Skip to main content

no-search-page-link-when-search-page-disabled

Disallow theme-config navbar or footer links to /search when search page support is explicitly disabled.

Targeted pattern scopeโ€‹

This rule focuses on docusaurus.config.* files.

It reports theme-config navbar or footer links to /search when search config sets:

  • searchPagePath: false

under either:

  • themeConfig.docsearch
  • themeConfig.algolia

What this rule reportsโ€‹

This rule reports links to the default search page when that search page has been explicitly disabled.

Why this rule existsโ€‹

Disabling the search page and still linking to /search creates a broken or misleading navigation experience.

That is a real config mismatch, not a style preference.

โŒ Incorrectโ€‹

export default {
themeConfig: {
docsearch: {
apiKey: "KEY",
appId: "APP",
indexName: "docs",
searchPagePath: false,
},
navbar: {
items: [{ to: "/search", label: "Search" }],
},
},
};

โœ… Correctโ€‹

export default {
themeConfig: {
docsearch: {
apiKey: "KEY",
appId: "APP",
indexName: "docs",
searchPagePath: false,
},
navbar: {
items: [{ to: "/docs", label: "Docs" }],
},
},
};

Behavior and migration notesโ€‹

This rule reports only.

If you want a dedicated search page, keep searchPagePath enabled and point your navigation at that route deliberately.

ESLint flat config exampleโ€‹

import docusaurus2 from "eslint-plugin-docusaurus-2";

export default [docusaurus2.configs.recommended];

When not to use itโ€‹

Do not use this rule if your navigation intentionally points to a custom /search page that is unrelated to Docusaurus DocSearch page support.

Rule catalog ID: R119

Further readingโ€‹