Documentation 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.config.js is the single source of truth for your Docusaurus site. Rather than scattering settings across many files, Docusaurus centralizes everything — URLs, navigation, plugins, theming, and internationalization — in one place. This makes it easy for contributors to understand and customize the site without hunting through the codebase.
File format
The config file runs in Node.js and can export a plain object, a function, or an async function. All four styles below produce identical results:- ES module (default)
- CommonJS
- TypeScript
- Async function
docusaurus.config.js
You must use
export default (ES modules) or module.exports (CommonJS) to export the config. Named exports are not supported.Site metadata
These fields describe who you are and where the site lives. They are used in page titles, browser tabs, social sharing cards, and to resolve static asset paths correctly.title
title
Type:
stringThe name of your site. Appears in the browser tab, navbar, and as the HTML <title> suffix.tagline
tagline
Type:
stringA short description shown on the home page and in social sharing metadata.url
url
Type: For a site served at
stringThe root URL of your deployed site, without a trailing slash. Required for generating correct canonical URLs and sitemap entries.https://my-org.com/my-project/, the value is https://my-org.com.baseUrl
baseUrl
Type:
stringThe path prefix for the site, with a trailing slash. Set to '/' when the site is at the domain root. Set to '/my-project/' when served from a subpath.favicon
favicon
Type:
stringPath to the favicon, relative to the static/ directory.Deployment configuration
These fields are used by thedocusaurus deploy command when publishing to GitHub Pages. You can also set them via environment variables (ORGANIZATION_NAME, PROJECT_NAME, DEPLOYMENT_BRANCH).
organizationName
organizationName
Type:
stringThe GitHub user or organization that owns the deployment repository.projectName
projectName
Type:
stringThe name of the GitHub repository to deploy to.deploymentBranch
deploymentBranch
Type:
stringThe branch that GitHub Pages serves from. Defaults to 'gh-pages' for project repositories (those whose projectName does not end in .github.io).trailingSlash
trailingSlash
Type:
boolean | undefinedControls whether URLs end with a trailing slash and how output HTML files are named. Different static hosts handle trailing slashes differently, so setting an explicit value avoids 404s and redirect chains. Recommended when deploying to GitHub Pages or Netlify.Presets, plugins, and themes
Docusaurus functionality is provided through plugins. A preset is a convenient bundle of plugins and themes —@docusaurus/preset-classic is the standard starting point.
Using presets
docusaurus.config.js
Adding individual plugins
If you need a plugin that is not included in your preset, add it to theplugins array:
docusaurus.config.js
Loading local plugins
Point to a directory containing the plugin source:docusaurus.config.js
themeConfig
themeConfig controls the visual appearance and behavior of the classic theme: the navbar, footer, color mode, and more.
docusaurus.config.js
navbar
Configures the top navigation bar: site title, logo, and nav links. Items can be links, dropdowns, doc sidebar links, or version selectors.
footer
Configures the site footer: link columns, copyright text, and style (
dark or light).colorMode
Controls light/dark mode defaults. Set
respectPrefersColorScheme: true to follow the user’s OS preference.prism
Controls syntax highlighting. Add languages to
additionalLanguages to enable highlighting beyond the defaults.Internationalization (i18n)
Thei18n object configures locale support. When set up, docusaurus build --locale fr generates a translated build for the fr locale.
docusaurus.config.js
Custom fields
Docusaurus validates the shape ofdocusaurus.config.js and rejects unknown top-level keys. To attach arbitrary data — for example, environment variables you want available in React components — use customFields:
docusaurus.config.js
useDocusaurusContext hook:
Complete example
The following config is a realistic starting point for a project documentation site:docusaurus.config.js