home chevron_right
config.php

config.php referencelink

Docara loads config.php from your project root (and merges config.<env>.php if present). Use it to tune URLs, locales, caching, navigation helpers, and landing page behaviour.

Core flagslink

  • baseUrl — canonical site URL; used for link generation.
  • production — boolean; toggles minification/asset behaviour.
  • category — switch between single-tree and category mode for docs navigation.
  • indexPage — optional landing slug without locale (e.g. collections/intro). If omitted, Docara auto-selects a page (locale root or first available page/category).
  • defaultLocale — locale code used when no locale segment is detected.

Paths & cachinglink

  • cache — enable Docara cache.
  • cachePath — where cache files are stored (default .cache in project root).
  • lang_path — path to language files (defaults to source/lang).
  • buildPath (set in container, exposed via config) — controls source and destination roots for builds.
  • moduleCache — bool, default: false. Enables per-page module bundle cache. When true, Docara builds hash.css/js per page, embeds core.css into hash.css, removes the standalone core.css link from templates, and serves the combined file. Overrides via DOCARA_MODULE_CACHE.

Metadata & frontendlink

  • siteName, siteDescription — shown in templates.
  • github — base repo URL for "Edit on GitHub" links.
  • locales — map of locale code to human-readable name; drives language switcher.
  • tags — array of custom tag class short names registered by Docara.
  • turbo — enable Turbo Drive navigation (default: false). When true, Docara JS tears down listeners/observers on turbo:before-render and re-inits on turbo:load; keep your own scripts Turbo-safe too.

Helpers (closures)link

These are callable values consumed by templates; you can override them to change behaviour:

  • getNavItems($page) — return prev/next navigation items.
  • getMenu($page) — return sidebar items; respects category mode.
  • generateBreadcrumbs($page) — build breadcrumbs for current path.
  • getJsTranslations($page) — expose translation strings to JS.
  • isHome($page) — decide if current page is the locale landing page.
  • layout — layout configuration tree (header/aside/main/footer/floating), see stubs/site/config.php for defaults.

Layout skeletonlink

Docara ships a layout tree you can override in config.php via the layout key. A shortened excerpt from stubs/site/config.php:

$layoutConfiguration = [
    'base' => [
        'header' => [
            'enabled' => true,
            'blocks' => [
                'logo' => ['enabled' => true],
                'topMenu' => ['enabled' => true],
                'search' => ['enabled' => true],
                'toolbar' => [
                    'enabled' => true,
                    'items' => [
                        ['type' => 'button', 'label' => 'Feedback', 'action' => '/feedback'],
                        ['type' => 'menu', 'label' => 'Share', 'items' => [...]],
                    ],
                ],
            ],
        ],
        'asideLeft' => ['enabled' => true, 'blocks' => ['menu' => ['enabled' => true]]],
        'main' => ['innerContent' => ['enabled' => true], 'outerContent' => ['enabled' => false]],
        'asideRight' => ['enabled' => true, 'blocks' => ['navigation' => ['enabled' => true]]],
        'footer' => ['enabled' => false],
        'floating' => ['enabled' => true, 'fabBackToTop' => ['enabled' => true]],
    ],
];

return [
    // ...
    'layout' => $layoutConfiguration,
];

Disable or extend individual blocks (e.g., add toolbar items, hide asideRight, enable outerContent iframe) without touching Blade templates—Docara reads this tree at runtime.

Example minimal configlink

return [
    'baseUrl' => '',
    'category' => false,
    'indexPage' => 'config', // optional landing slug
    'locales' => ['en' => 'English'],
    'defaultLocale' => 'en',
    'siteName' => 'Simai Documentation',
    'siteDescription' => 'Simai framework documentation',
];