|
| 1 | +--- |
| 2 | +title: Global themes |
| 3 | +subtitle: Share a consistent visual identity across multiple documentation sites. |
| 4 | +description: Learn how to use global themes to define branding in one repository and apply it automatically across child documentation sites. |
| 5 | +--- |
| 6 | + |
| 7 | +Global themes let a single "control" repository define the shared visual identity (logo, colors, fonts, layout, CSS, JS, and more) for your organization's documentation. Child repositories reference the theme by name and inherit those settings automatically when they publish. |
| 8 | + |
| 9 | +This is useful when your organization maintains multiple documentation sites that should share the same branding. |
| 10 | + |
| 11 | +## How it works |
| 12 | + |
| 13 | +<Steps> |
| 14 | + |
| 15 | +### Export a theme from your control repository |
| 16 | + |
| 17 | +From the repository that defines your canonical branding, run: |
| 18 | + |
| 19 | +```bash |
| 20 | +fern docs theme export |
| 21 | +``` |
| 22 | + |
| 23 | +This reads the theme-eligible fields from your `docs.yml` and produces a `theme.yml` file along with copies of any local assets (logos, fonts, CSS, JS) in a `fern/theme/` directory. |
| 24 | + |
| 25 | +Use `--output` to specify a different directory: |
| 26 | + |
| 27 | +```bash |
| 28 | +fern docs theme export --output ./my-theme |
| 29 | +``` |
| 30 | + |
| 31 | +### Upload the theme |
| 32 | + |
| 33 | +Upload the exported theme to Fern's registry: |
| 34 | + |
| 35 | +```bash |
| 36 | +fern docs theme upload --name my-theme |
| 37 | +``` |
| 38 | + |
| 39 | +This uploads the theme configuration and all referenced file assets. If you omit `--name`, the theme is saved as `default`. |
| 40 | + |
| 41 | +### Confirm the upload |
| 42 | + |
| 43 | +List all themes for your organization: |
| 44 | + |
| 45 | +```bash |
| 46 | +fern docs theme list |
| 47 | +``` |
| 48 | + |
| 49 | +Use `--json` for machine-readable output that includes `updatedAt` timestamps: |
| 50 | + |
| 51 | +```bash |
| 52 | +fern docs theme list --json |
| 53 | +``` |
| 54 | + |
| 55 | +### Reference the theme from a child repository |
| 56 | + |
| 57 | +In a child repository's `docs.yml`, add: |
| 58 | + |
| 59 | +```yaml docs.yml |
| 60 | +global-theme: my-theme |
| 61 | +``` |
| 62 | +
|
| 63 | +### Publish as normal |
| 64 | +
|
| 65 | +Run the standard publish command from the child repository: |
| 66 | +
|
| 67 | +```bash |
| 68 | +fern generate --docs |
| 69 | +``` |
| 70 | + |
| 71 | +The CLI fetches the named theme from Fern's registry, downloads any file assets, merges the theme into the local `docs.yml` configuration, and publishes the merged result. No extra steps are needed. |
| 72 | + |
| 73 | +</Steps> |
| 74 | + |
| 75 | +## What the theme controls |
| 76 | + |
| 77 | +When a global theme is applied, the theme's values take precedence for branding fields while the child repository retains control of its content and structure. |
| 78 | + |
| 79 | +**Owned by the theme (control repository)** |
| 80 | + |
| 81 | +- `logo` - brand logo images and link |
| 82 | +- `favicon` - browser tab icon |
| 83 | +- `background-image` - page background |
| 84 | +- `colors` - accent and background colors |
| 85 | +- `typography` - body, heading, and code fonts |
| 86 | +- `layout` - sidebar width, content width, tab and searchbar placement |
| 87 | +- `theme` - light/dark mode default |
| 88 | +- `settings` - display settings |
| 89 | +- `integrations` - analytics and tracking |
| 90 | +- `css` - custom stylesheets |
| 91 | +- `js` - custom scripts |
| 92 | +- `header` - custom header component |
| 93 | +- `footer` - custom footer component |
| 94 | +- `navbar-links` - top navigation links |
| 95 | +- `footer-links` - footer navigation links |
| 96 | +- `ai-search` - AI search configuration |
| 97 | +- `announcement` - announcement banner |
| 98 | +- `metadata` - SEO metadata |
| 99 | + |
| 100 | +**Owned by the child repository** |
| 101 | + |
| 102 | +- `navigation` - tabs, sections, pages |
| 103 | +- `apis` - API references |
| 104 | +- `redirects` |
| 105 | +- `versions` |
| 106 | +- `instances` - domain and URL |
| 107 | + |
| 108 | +## Updating a theme |
| 109 | + |
| 110 | +To update a theme, make changes to the control repository's `docs.yml`, re-export, and re-upload with the same name. The next time a child repository publishes, it picks up the updated theme automatically. |
| 111 | + |
| 112 | +```bash |
| 113 | +fern docs theme export |
| 114 | +fern docs theme upload --name my-theme |
| 115 | +``` |
0 commit comments