docusaurus-search-local icon indicating copy to clipboard operation
docusaurus-search-local copied to clipboard

Search bar doesn't appear

Open Skipper0707 opened this issue 4 years ago • 2 comments

Hello I've followed through the installation guide but, the search bar does not appear after the build as if the plugin's not working, I'm sure there's some misconfiguration on my part but, troubleshooting has been proving fruitless so far. I'd be delighted if I'd get any help figuring this out.

Report: I entered the npm install --save @easyops-cn/docusaurus-search-local in my project directory and then added the plugin in the docusaurus.config.js as below:

There are no errors, everything seems fine but the search bar doesn't appear

const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");

/** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = {
  plugins: [
     [require.resolve("@easyops-cn/docusaurus-search-local"),
             {hashed: true}
     ],
  ],

  title: "TITLE",
  tagline: "TAGLINE",
  url: "https://your-docusaurus-test-site.com",
  baseUrl: "/",
  onBrokenLinks: "warn",
  onBrokenMarkdownLinks: "warn",
  favicon: "IMG",
  organizationName: "facebook", // Usually your GitHub org/user name.
  projectName: "docusaurus", // Usually your repo name.
  themeConfig: {
    navbar: {
      title: "TITLE",
      logo: {
        alt: "TITLE",
        src: "IMG"
      },
      items: [
        {
          type: "doc",
          docId: "Home",
          position: "left",
          label: "Documents"
        },
      ]
    },
    footer: {
      style: "dark",
      links: [
        {
          title: "Docs",
          items: [
            {
              label: "Home",
              to: "/docs/Home"
            },

          ]
        },
        ],
       },
    prism: {
      theme: lightCodeTheme,
      darkTheme: darkCodeTheme
    }
  },
  presets: [
    [
      "@docusaurus/preset-classic",
      {
        docs: {
          sidebarPath: require.resolve("./sidebars.js"),
          // Please change this to your repo.
          editUrl: "https://github.com/facebook/docusaurus/edit/master/website/"
        },
        blog: {
          showReadingTime: true,
          // Please change this to your repo.
          editUrl:
            "https://github.com/facebook/docusaurus/edit/master/website/blog/"
        },
        theme: {
          customCss: require.resolve("./src/css/custom.css")
        }
      }
    ]
  ]
};

I copied the whole config file in case it'd help figure this out.

Many thanks in advance.

Skipper0707 avatar Oct 27 '21 12:10 Skipper0707

https://github.com/facebook/docusaurus/issues/6488 But in your case you can try configure plugins after presets

reutenkoivan avatar Jan 27 '22 18:01 reutenkoivan

@easyops-cn/docusaurus-search-local should be loaded in themes and not in plugins also you are missing this navbar item:

        {
          type: 'search',
          position: 'right',
        },

noraj avatar Sep 03 '22 20:09 noraj