Skip to main content

no-search-link-without-search-provider

Disallow linking theme-config navbar or footer items to the default search page when no known search provider is configured.

Targeted pattern scopeโ€‹

This rule focuses on docusaurus.config.* files.

It inspects theme-config navbar/footer link items that point to:

  • /search

and reports them when no known search provider is configured through:

  • themeConfig.docsearch
  • themeConfig.algolia
  • a supported local-search provider module

What this rule reportsโ€‹

This rule reports default search-page links that appear in theme-config navigation even though the site config does not currently declare a known search provider.

Why this rule existsโ€‹

A visible /search navigation link strongly implies that the site actually has a search integration behind it.

If the config has no known search provider, that link is usually misleading or broken for users.

โŒ Incorrectโ€‹

export default {
themeConfig: {
navbar: {
items: [{ label: "Search", to: "/search" }],
},
},
};

โœ… Correctโ€‹

export default {
themes: ["@easyops-cn/docusaurus-search-local"],
themeConfig: {
navbar: {
items: [{ label: "Search", to: "/search" }],
},
},
};

Behavior and migration notesโ€‹

This rule is report-only.

It does not automatically remove the link because some projects may intentionally route /search to a custom page that this plugin cannot prove from config alone.

Additional examplesโ€‹

export default {
themeConfig: {
footer: {
links: [
{
title: "Resources",
items: [{ label: "Search", href: "/search" }],
},
],
},
},
};

โœ… Correct โ€” DocSearch configuredโ€‹

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

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 project intentionally ships a custom /search page without one of the known search-provider config surfaces that this plugin understands.

Rule catalog ID: R105

Further readingโ€‹