Configuration Reference

This reference documents all available configuration options for ptero.config.ts. The configuration file uses TypeScript for type safety and IDE autocomplete.

Configuration File

Create ptero.config.ts in your project root:

import type { PteroConfig } from 'ptero-core';

const config: PteroConfig = {
	// Your configuration here
};

export default config;

Top-Level Options

site

Type: SiteConfig Required: Yes

Global site settings and metadata.

site: {
  title: 'My Documentation',
  description: 'Comprehensive documentation for my project',
  url: 'https://docs.example.com',
  logo: '/logo.svg',
  favicon: '/favicon.ico',
  social: {
    github: 'https://github.com/username/repo',
    twitter: 'https://twitter.com/username'
  }
}

site.title

Type: string Required: Yes

The title of your documentation site. Appears in the browser tab, header, and meta tags.

title: 'Ptero Documentation';

site.description

Type: string Required: No

A short description of your documentation site for SEO and social media sharing.

description: 'Modern documentation engine for SvelteKit';

site.url

Type: string Required: Yes

The canonical URL where your documentation is hosted. Used for generating absolute URLs in sitemaps and social meta tags.

url: 'https://docs.example.com';

site.baseUrl

Type: string Default: '/'

The base path for your documentation if hosted in a subdirectory.

baseUrl: '/docs'; // Site accessible at example.com/docs

Type: string Required: No

Path to your site logo, relative to the static directory.

logo: '/images/logo.svg';

site.favicon

Type: string Default: '/favicon.ico'

Path to your favicon.

favicon: '/favicon.ico';

site.social

Type: SocialLinks Required: No

Social media and repository links displayed in the header/footer.

social: {
  github: 'https://github.com/username/repo',
  twitter: 'https://twitter.com/username',
  discord: 'https://discord.gg/invite',
  linkedin: 'https://linkedin.com/company/name'
}

versions

Type: VersionConfig Required: Yes

Configuration for documentation versioning.

versions: {
  current: 'v2.0',
  available: [
    { id: 'v2.0', label: 'v2.0', status: 'latest' },
    { id: 'v1.5', label: 'v1.5', status: 'stable' },
    { id: 'v1.0', label: 'v1.0', status: 'legacy' },
    { id: 'v3.0', label: 'v3.0-beta', status: 'next' }
  ],
  aliases: {
    latest: 'v2.0',
    stable: 'v1.5',
    next: 'v3.0'
  }
}

versions.current

Type: string Required: Yes

The current/default version. Users are redirected here when visiting /docs.

current: 'latest';

versions.available

Type: Version[] Required: Yes

Array of all available documentation versions.

available: [
	{
		id: 'v2.0', // Version identifier (folder name)
		label: 'v2.0', // Display label
		status: 'latest' // Badge: latest, stable, legacy, next
	}
];

Status options:

  • 'latest' - Current recommended version
  • 'stable' - Stable production version
  • 'legacy' - Older, maintained version
  • 'next' - Beta/preview version

versions.aliases

Type: Record<string, string> Required: No

URL-friendly aliases that map to version IDs.

aliases: &#123;
  latest: 'v2.0',    // /docs/latest → /docs/v2.0
  next: 'v3.0'       // /docs/next → /docs/v3.0
&#125;

Type: SidebarConfig Required: No

Configuration for sidebar navigation. If omitted, sidebar is auto-generated from content structure.

sidebar: &#123;
	sections: [
		&#123;
			title: 'Introduction',
			items: [
				&#123; title: 'What is Ptero?', slug: 'intro/what-is-ptero' &#125;,
				&#123; title: 'Installation', slug: 'intro/installation' &#125;
			]
		&#125;,
		&#123;
			title: 'Guides',
			items: [
				&#123; title: 'Configuration', slug: 'guides/configuration' &#125;,
				&#123; title: 'Content Authoring', slug: 'guides/content-authoring' &#125;
			]
		&#125;
	];
&#125;

sidebar.sections

Type: SidebarSection[] Required: No

Explicit sidebar structure. Each section can contain pages or nested sections.

sections: [
	&#123;
		title: 'Getting Started',
		collapsed: false,
		items: [
			&#123; title: 'Introduction', slug: 'intro' &#125;,
			&#123;
				title: 'Installation',
				slug: 'installation',
				items: [
					// Nested items
					&#123; title: 'Quick Start', slug: 'installation/quick-start' &#125;,
					&#123; title: 'Manual Setup', slug: 'installation/manual' &#125;
				]
			&#125;
		]
	&#125;
];

SidebarSection fields:

  • title (string, required) - Section heading
  • collapsed (boolean, optional) - Initially collapsed state
  • items (SidebarItem[], required) - Pages in this section

SidebarItem fields:

  • title (string, required) - Link text
  • slug (string, required) - Page path (without version prefix)
  • items (SidebarItem[], optional) - Nested items
  • badge (string, optional) - Badge text (e.g., “New”, “Beta”)

theme

Type: ThemeConfig Required: No

Theme customization options.

theme: &#123;
  primary: '#3b82f6',
  dark: &#123;
    primary: '#60a5fa'
  &#125;,
  font: &#123;
    sans: 'Inter, system-ui, sans-serif',
    mono: 'Fira Code, monospace'
  &#125;,
  darkMode: 'class',
  defaultMode: 'light'
&#125;

theme.primary

Type: string Default: '#3b82f6'

Primary brand color for light mode.

primary: '#ff3e00'; // Svelte orange

theme.dark

Type: Partial<ThemeColors> Required: No

Color overrides for dark mode.

dark: &#123;
  primary: '#ff6b35',
  background: '#0a0a0a',
  text: '#f5f5f5'
&#125;

theme.font

Type: FontConfig Required: No

Font family configuration.

font: &#123;
  sans: 'Inter, -apple-system, system-ui, sans-serif',
  mono: '"Fira Code", "JetBrains Mono", monospace'
&#125;

theme.darkMode

Type: 'class' | 'media' Default: 'class'

Dark mode strategy:

  • 'class' - Manual toggle with class on <html>
  • 'media' - Respect OS preference only
darkMode: 'class';

theme.defaultMode

Type: 'light' | 'dark' | 'system' Default: 'system'

Default color mode on first visit.

defaultMode: 'dark';

Type: SearchConfig Required: No

Search functionality configuration.

search: &#123;
  enabled: true,
  placeholder: 'Search documentation...',
  hotkey: 'k',
  resultsLimit: 20,
  fuzzyThreshold: 0.3,
  indexFields: ['title', 'description', 'content', 'headings']
&#125;

search.enabled

Type: boolean Default: true

Enable or disable search functionality.

enabled: true;

search.placeholder

Type: string Default: 'Search documentation...'

Placeholder text in search input.

placeholder: 'Search docs (⌘K)';

search.hotkey

Type: string Default: 'k'

Keyboard shortcut key (used with Cmd/Ctrl).

hotkey: 'k'; // Cmd+K / Ctrl+K

search.resultsLimit

Type: number Default: 20

Maximum number of search results to display.

resultsLimit: 10;

search.fuzzyThreshold

Type: number (0-1) Default: 0.3

Fuse.js fuzzy matching threshold. Lower = stricter matches.

fuzzyThreshold: 0.2; // More strict

search.indexFields

Type: string[] Default: ['title', 'description', 'content']

Fields to include in search index.

indexFields: ['title', 'description', 'content', 'headings', 'keywords'];

Type: NavigationConfig Required: No

Additional navigation configuration.

navigation: &#123;
  breadcrumbs: true,
  prevNext: true,
  editLink: &#123;
    pattern: 'https://github.com/user/repo/edit/main/src/content/docs/&#123;slug&#125;.md',
    text: 'Edit this page'
  &#125;,
  feedback: &#123;
    enabled: true,
    helpful: 'Was this page helpful?',
    yes: 'Yes',
    no: 'No'
  &#125;
&#125;

Type: boolean Default: true

Show breadcrumb navigation.

breadcrumbs: true;

Type: boolean Default: true

Show previous/next page navigation at the bottom.

prevNext: true;

Type: EditLinkConfig Required: No

Configuration for “Edit this page” links.

editLink: &#123;
  pattern: 'https://github.com/user/repo/edit/main/src/content/docs/&#123;slug&#125;.md',
  text: 'Edit this page on GitHub'
&#125;

The {slug} placeholder is replaced with the page path.

Type: FeedbackConfig Required: No

Page feedback widget configuration.

feedback: &#123;
  enabled: true,
  helpful: 'Was this helpful?',
  yes: 'Yes',
  no: 'No',
  onFeedback: (helpful, page) =&gt; &#123;
    // Track feedback
    analytics.track('page_feedback', &#123; helpful, page &#125;);
  &#125;
&#125;

metadata

Type: MetadataConfig Required: No

SEO and social media metadata.

metadata: &#123;
  openGraph: &#123;
    type: 'website',
    siteName: 'My Docs',
    image: '/og-image.png'
  &#125;,
  twitter: &#123;
    card: 'summary_large_image',
    site: '@username',
    creator: '@username'
  &#125;
&#125;

Complete Example

import type &#123; PteroConfig &#125; from 'ptero-core';

const config: PteroConfig = &#123;
	site: &#123;
		title: 'Ptero Documentation',
		description: 'Modern documentation engine for SvelteKit',
		url: 'https://ptero.dev',
		logo: '/logo.svg',
		social: &#123;
			github: 'https://github.com/username/ptero'
		&#125;
	&#125;,

	versions: &#123;
		current: 'latest',
		available: [&#123; id: 'v1.0', label: 'v1.0', status: 'latest' &#125;]
	&#125;,

	sidebar: &#123;
		sections: [
			&#123;
				title: 'Introduction',
				items: [
					&#123; title: 'What is Ptero?', slug: 'intro/what-is-ptero' &#125;,
					&#123; title: 'Installation', slug: 'intro/installation' &#125;
				]
			&#125;
		]
	&#125;,

	theme: &#123;
		primary: '#3b82f6',
		font: &#123;
			sans: 'Inter, sans-serif',
			mono: 'Fira Code, monospace'
		&#125;
	&#125;,

	search: &#123;
		enabled: true,
		resultsLimit: 20
	&#125;,

	navigation: &#123;
		editLink: &#123;
			pattern: 'https://github.com/user/repo/edit/main/src/content/docs/&#123;slug&#125;.md'
		&#125;
	&#125;
&#125;;

export default config;

TypeScript Types

Import types for autocomplete and validation:

import type &#123;
	PteroConfig,
	SiteConfig,
	VersionConfig,
	SidebarConfig,
	ThemeConfig,
	SearchConfig
&#125; from 'ptero-core';

Validation

Configuration is validated at build time using Zod schemas. Invalid configuration will produce helpful error messages pointing to the issue.

Next Steps