Docusaurus is built entirely around plugins — the core framework provides no features of its own. Every route on your site exists because a plugin created it. The docs section comes fromDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/facebook/docusaurus/llms.txt
Use this file to discover all available pages before exploring further.
@docusaurus/plugin-content-docs, the blog from @docusaurus/plugin-content-blog, and individual pages from @docusaurus/plugin-content-pages. Understanding plugins and presets is the key to understanding how to extend and configure your site.
Plugins vs. presets
A plugin is a single npm package that adds one capability to your site. A preset is a bundle of plugins and themes distributed together. Rather than configuring@docusaurus/plugin-content-docs, @docusaurus/plugin-content-blog, @docusaurus/plugin-sitemap, and others one by one, the @docusaurus/preset-classic preset lets you configure all of them in one place.
Most new Docusaurus sites use preset-classic and rarely need to add standalone plugins directly — unless they need something that the preset doesn’t include.
Installing a plugin
Plugins are npm packages. Install them the same way you install any other dependency:- npm
- yarn
- pnpm
docusaurus.config.js:
docusaurus.config.js
docusaurus.config.js
Configuring plugin options
Plugins accept options through a two-element tuple — the plugin name (or path) paired with an options object. This pattern is sometimes called “Babel style”:docusaurus.config.js
docusaurus.config.js
Multi-instance plugins
Some plugins, including the docs and blog plugins, can be registered more than once. Each instance requires a uniqueid:
docusaurus.config.js
At most one plugin instance can omit the
id (or use id: 'default'). That instance becomes the “default” instance.The @docusaurus/preset-classic preset
The classic preset is the standard starting point for new Docusaurus sites. It bundles the following packages:
@docusaurus/theme-classic
The default theme — Navbar, Footer, sidebar, color mode toggle, and all UI components.
@docusaurus/plugin-content-docs
Docs plugin — versioning, sidebar generation, and MDX rendering for documentation pages.
@docusaurus/plugin-content-blog
Blog plugin — post listing, tags, authors, and RSS/Atom feed generation.
@docusaurus/plugin-content-pages
Pages plugin — renders React and MDX files from the
src/pages directory as standalone routes.@docusaurus/plugin-sitemap
Generates
sitemap.xml automatically for production builds.@docusaurus/theme-search-algolia
Algolia DocSearch integration for full-text site search.
@docusaurus/plugin-debug, @docusaurus/plugin-google-gtag, @docusaurus/plugin-google-tag-manager, and @docusaurus/plugin-svgr.
Configuring the preset
Each option key in the preset config maps directly to the corresponding plugin or theme. Passfalse to disable a plugin entirely:
docusaurus.config.js
Installing the preset separately
If you created your site without the classic preset, install it manually:- npm
- yarn
Module shorthands
Docusaurus supports shorthand resolution for plugin, theme, and preset names. When you write a short name, Docusaurus tries the following names in order (shown here for theplugins field):
| Short name | Resolved as |
|---|---|
sitemap | @docusaurus/plugin-sitemap |
awesome | docusaurus-plugin-awesome |
@my-company | @my-company/docusaurus-plugin |
@my-company/awesome | @my-company/docusaurus-plugin-awesome |
[name] → @docusaurus/[type]-[name] → docusaurus-[type]-[name], where [type] is plugin, theme, or preset depending on which config field the name appears in.
Writing a local plugin
If the community doesn’t have what you need, you can write a plugin directly in your repository. A plugin is a function that receives the Docusaurus context and your options, and returns a plugin object:src/plugins/my-plugin.js
docusaurus.config.js
Local plugins follow the same lifecycle API as published plugins. See the plugin method references for the full list of lifecycle hooks including
loadContent, contentLoaded, configureWebpack, and more.