Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Puppeteer Puppeteer Docusaurus Config

From Leeroopedia
Property Value
sources website/docusaurus.config.js
domains Documentation, Website Configuration, API Reference
last_updated 2026-02-12 00:00 GMT

Overview

Description

The Docusaurus Config module defines the configuration for Puppeteer's official documentation website hosted at pptr.dev. It uses Docusaurus v2/v3 with the classic preset and provides extensive customization for sidebar generation, navigation, theming, search, and URL redirects.

Key configuration aspects include:

  • Custom sidebar generation -- A sophisticated sidebarItemsGenerator function that organizes API documentation into namespaced categories (PuppeteerNode, Browser, Page, ElementHandle, etc.) with a defined display order. Separate ordering is applied for the browsers API vs. the main Puppeteer API.
  • SWC loader -- Uses swc-loader instead of Babel for faster TypeScript/TSX compilation in the webpack configuration
  • Algolia search -- Integrated Algolia DocSearch with app ID DVKY664LG7 and index pptr
  • Client redirects -- Multiple redirect rules for legacy URLs (e.g., /guides to /category/guides, /chromium-support to /supported-browsers)
  • Archived versions -- Links to API documentation for older Puppeteer versions loaded from versionsArchived.json, with URL format varying by version (pre-15.3.0, 15.3.0-19.3.0, and 19.3.0+)
  • Prism syntax highlighting -- GitHub (light) and Dracula (dark) themes with bash, diff, and JSON language support
  • npm2yarn plugin -- Remark plugin for automatic npm-to-yarn command conversion

Usage

This configuration file is the entry point for building and serving the Puppeteer documentation website. It is used by the Docusaurus build system and is not imported by any runtime code.

Code Reference

Source Location

website/docusaurus.config.js

Signature

/** @type {import('@docusaurus/types').Config} */
const config = {
  title: 'Puppeteer',
  tagline: 'Headless Chrome Node.js API',
  url: 'https://pptr.dev',
  baseUrl: '/',
  // ... full configuration object
};

module.exports = config;

Import

// This file is loaded automatically by Docusaurus.
// No manual import is needed.

I/O Contract

Site Configuration

Property Value Description
title Puppeteer Site title displayed in navbar and browser tab
url https://pptr.dev Production URL of the documentation site
baseUrl / Base URL path for the site
organizationName puppeteer GitHub organization name
projectName puppeteer GitHub repository name
trailingSlash false No trailing slashes on URLs

Navigation Structure

Item Type Position
Docs docSidebar (docs) left
Puppeteer API docSidebar (api) left
@puppeteer/browsers API docSidebar (browsersApi) left
Version Dropdown docsVersionDropdown right
GitHub Link icon link right

API Sidebar Namespace Order (Puppeteer API)

Order Namespaces
1-5 PuppeteerNode, Puppeteer, Browser, BrowserContext, Page
6-10 Locator, WebWorker, Accessibility, Keyboard, Mouse
11-15 Touchscreen, Tracing, FileChooser, Dialog, ConsoleMessage
16-20 Frame, JSHandle, ElementHandle, HTTPRequest, HTTPResponse
21-23 SecurityDetails, Target, CDPSession, Coverage, TimeoutError, EventEmitter

Client Redirects

From To
/guides /category/guides
/docs /guides/what-is-puppeteer
/chromium-support /supported-browsers
/guides/query-selectors /guides/page-interactions
/guides/request-interception /guides/network-interception
/guides/locators /guides/page-interactions
/guides/evaluate-javascript /guides/javascript-execution

Usage Examples

// Build the documentation site
// cd website && npx docusaurus build

// Start the development server
// cd website && npx docusaurus start

// The getApiUrl function determines the correct URL format for archived versions
function getApiUrl(version) {
  if (semver.gte(version, '19.3.0')) {
    return `https://github.com/puppeteer/puppeteer/blob/puppeteer-${version}/docs/api/index.md`;
  } else if (semver.gte(version, '15.3.0')) {
    return `https://github.com/puppeteer/puppeteer/blob/${version}/docs/api/index.md`;
  } else {
    return `https://github.com/puppeteer/puppeteer/blob/${version}/docs/api.md`;
  }
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment