Skip to content

Commit 408e408

Browse files
docs: add global themes documentation page and CLI command reference (#5170)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent afca465 commit 408e408

4 files changed

Lines changed: 209 additions & 0 deletions

File tree

fern/products/cli-api-reference/pages/commands.mdx

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ hideOnThisPage: true
2727
| [`fern docs preview list`](#fern-docs-preview-list) | List all preview deployments |
2828
| [`fern docs preview delete`](#fern-docs-preview-delete) | Delete a preview deployment |
2929
| [`fern docs md check`](#fern-docs-md-check) | Validate MDX syntax in documentation files |
30+
| [`fern docs theme export`](#fern-docs-theme-export) | Export theme-eligible fields from `docs.yml` into a standalone directory |
31+
| [`fern docs theme upload`](#fern-docs-theme-upload) | Upload a theme to Fern's registry |
32+
| [`fern docs theme list`](#fern-docs-theme-list) | List all themes for your organization |
3033

3134
## SDK generation commands
3235

@@ -819,4 +822,84 @@ hideOnThisPage: true
819822
- `response.body``responses.<status>.content.*.example`
820823

821824
</Accordion>
825+
826+
<Accordion title="fern docs theme export">
827+
828+
Use `fern docs theme export` to extract the theme-eligible fields from your `docs.yml` into a standalone directory. The exported `theme.yml` and its assets can then be uploaded with `fern docs theme upload`.
829+
830+
<CodeBlock title="terminal">
831+
```bash
832+
fern docs theme export [--output <directory>]
833+
```
834+
</CodeBlock>
835+
836+
By default, files are written to `./fern/theme/`.
837+
838+
### output
839+
840+
Use `--output` to specify a custom directory for the exported theme.
841+
842+
```bash
843+
fern docs theme export --output ./my-theme
844+
```
845+
846+
</Accordion>
847+
848+
<Accordion title="fern docs theme upload">
849+
850+
Use `fern docs theme upload` to upload a theme to Fern's registry. The command reads `theme.yml` from `./fern/theme/` and uploads it along with any referenced file assets.
851+
852+
<CodeBlock title="terminal">
853+
```bash
854+
fern docs theme upload [--name <name>] [--org <org>]
855+
```
856+
</CodeBlock>
857+
858+
### name
859+
860+
Use `--name` to set the theme name. Defaults to `default`.
861+
862+
```bash
863+
fern docs theme upload --name my-theme
864+
```
865+
866+
### org
867+
868+
Use `--org` to override the organization ID from `fern.config.json`.
869+
870+
```bash
871+
fern docs theme upload --org my-org
872+
```
873+
874+
</Accordion>
875+
876+
<Accordion title="fern docs theme list">
877+
878+
Use `fern docs theme list` to list all themes uploaded for your organization.
879+
880+
<CodeBlock title="terminal">
881+
```bash
882+
fern docs theme list [--json] [--org <org>]
883+
```
884+
</CodeBlock>
885+
886+
By default, outputs one theme name per line.
887+
888+
### json
889+
890+
Use `--json` to output the full list as a JSON array, including `updatedAt` timestamps.
891+
892+
```bash
893+
fern docs theme list --json
894+
```
895+
896+
### org
897+
898+
Use `--org` to override the organization ID from `fern.config.json`.
899+
900+
```bash
901+
fern docs theme list --org my-org
902+
```
903+
904+
</Accordion>
822905
</AccordionGroup>

fern/products/docs/docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ navigation:
4242
- page: Page-level settings
4343
path: ./pages/navigation/frontmatter.mdx
4444
slug: page-level-settings
45+
- page: Global themes
46+
path: ./pages/configuration/global-themes.mdx
4547
- section: Writing content
4648
contents:
4749
- page: Markdown basics
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
tags: ["configuration"]
3+
---
4+
5+
## Global themes
6+
7+
Define your documentation branding in a single control repository and share it across multiple sites. Use the `fern docs theme` CLI commands to export, upload, and manage themes, then reference a theme by name in any child repository's `docs.yml` with the `global-theme` property.
8+
9+
<Button intent="none" outlined rightIcon="arrow-right" href="/learn/docs/configuration/global-themes">Read the docs</Button>
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
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

Comments
 (0)