Skip to content

Commit 45489ff

Browse files
devin-ai-integration[bot]chdeskurdevalog
authored
Document instance audiences feature (#1471)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Catherine Deskur <[email protected]> Co-authored-by: Catherine Deskur <[email protected]> Co-authored-by: Devin Logan <[email protected]>
1 parent c50fdfe commit 45489ff

File tree

4 files changed

+106
-2
lines changed

4 files changed

+106
-2
lines changed

fern/products/docs/pages/api-references/audiences.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,12 @@ navigation:
2020
</CodeBlocks>
2121
2222
Here's [an example from Schematic](https://github.com/SchematicHQ/schematic-fern-config/blob/e19f5ea69a343727ed018e79127bf4fd20ad0f7b/fern/docs.yml#L128-L129) in production.
23+
24+
## Instance audiences
25+
26+
API Reference audiences work alongside [instance audiences](/docs/configuration/products#add-instance-audiences), which control which products and versions appear in each documentation instance. You can use both features together:
27+
28+
- **API Reference audiences** - Control which endpoints and schemas appear within API References
29+
- **Instance audiences** - Control which products and versions appear in each instance
30+
31+
For example, you might have a `public` API Reference that shows only public endpoints. To ensure this API Reference only appears on your public documentation site, tag the containing product or version with the `public` audience.

fern/products/docs/pages/customization/what-is-docs-yml.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ An `instance` is the backend of a distinct docs website. Each instance is publis
119119
instances:
120120
- url: plantstore.docs.buildwithfern.com
121121
custom-domain: docs.plantstore.com
122+
audiences:
123+
- public
122124
```
123125

124126
<ParamField path="instances" type="list of objects" required={false} toc={true}>
@@ -137,6 +139,12 @@ instances:
137139
If specified, adds an "Edit this page" link to the bottom of each page that links to the given public GitHub repository. Learn more about the [`edit-this-page` configuration](#github-configuration).
138140
</ParamField>
139141

142+
<ParamField path="instances.audiences" type="list of strings" required={false} toc={true}>
143+
Specify which audiences this instance serves (e.g., internal developers, beta testers, public customers).
144+
145+
You can use audiences to control which versions and products appear in each documentation instance, enabling you to create separate sites for different user groups. Content is included when its audience tag matches the instance audience. Content without an audience tag is included by default. Learn more about configuring instance audiences for [products and/or versions](/docs/configuration/products#add-instance-audiences).
146+
</ParamField>
147+
140148
## Colors configuration
141149

142150
```yaml docs.yml

fern/products/docs/pages/navigation/products.mdx

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ If your `docs.yml` file includes a `navigation` field or a `tabs` field, be sure
119119
</Step>
120120
</Steps>
121121

122-
### Add versioning to your products (optional)
122+
### Add versioning to your products
123123

124124
You can optionally add versions to your products. Versioned and unversioned products can live next to each other in your site.
125125

@@ -213,6 +213,58 @@ If your product-specific `.yml` files for **versioned products** includes a `nav
213213
</Step>
214214
</Steps>
215215

216+
### Add instance audiences
217+
218+
Control which versions and/or products appear in each [documentation instance](/docs/configuration/what-is-docs-yml#instances-configuration) by tagging them with audiences. This enables separate sites for different user groups (e.g., internal developers, beta testers, public customers).
219+
220+
Content is filtered based on audience tags:
221+
222+
- **Match**: Content with an audience matching the instance audience is included
223+
- **No match**: Content with a non-matching audience is excluded
224+
- **No audience**: Content without an audience tag is included by default
225+
226+
Define audiences for instances, products, and versions in `docs.yml`:
227+
228+
<CodeBlock title="docs.yml">
229+
```yaml
230+
instances:
231+
- url: internal.docs.buildwithfern.com
232+
audiences:
233+
- internal # Only shows content tagged with 'internal'
234+
- url: public.docs.buildwithfern.com
235+
audiences:
236+
- public # Only shows content tagged with 'public'
237+
products:
238+
- display-name: Platform API
239+
path: ./products/platform-api.yml
240+
audiences:
241+
- public
242+
- internal # This product appears on both instances
243+
versions:
244+
- display-name: v3
245+
path: ./versions/v3.yml
246+
audiences:
247+
- public # This version only appears on the public instance
248+
- display-name: v2 (Internal)
249+
path: ./versions/v2.yml
250+
audiences:
251+
- internal # This version only appears on the internal instance
252+
- display-name: Admin Tools
253+
path: ./products/admin-tools.yml
254+
audiences:
255+
- internal # This product only appears on the internal instance
256+
```
257+
</CodeBlock>
258+
259+
<Accordion title="Combining with API Reference audiences">
260+
261+
Instance audiences work alongside [API Reference audiences](/docs/api-references/audiences), which filter endpoints and schemas within your API documentation. You can use both features together:
262+
263+
- **Instance audiences** - Control which products and versions appear in each instance
264+
- **API Reference audiences** - Control which endpoints and schemas appear within API References
265+
266+
For example, you might have a `public` instance that includes only public products. Within those products, the API Reference should be marked as `public` so it is filtered to show only `public` endpoints.
267+
</Accordion>
216268

217269
## Customize selector styling
218270

fern/products/docs/pages/navigation/versions.mdx

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Version-specific `yml` files:
4040

4141
<Markdown src="/snippets/version-specific-yml-files.mdx" />
4242

43-
<Note>You can also have multiple products, some versioned and some unversioned. For more information on setting up multiple products, follow our [product switching docs](/docs/configuration/products).</Note>
43+
<Note>You can also have [multiple products, some versioned and some unversioned](/docs/configuration/products).</Note>
4444
</Step>
4545
<Step title="Add your version configuration">
4646

@@ -79,6 +79,41 @@ versions:
7979
<Step title="Remove extra navigation from docs.yml">
8080
8181
If your `docs.yml` file includes a `navigation` field or a `tabs` field, be sure to remove. Those fields should now belong in the version-specific `.yml` files.
82+
</Step>
83+
<Step title="Add instance audiences">
84+
85+
Control which versions appear in each [documentation instance](/docs/configuration/what-is-docs-yml#instances-configuration) by tagging them with audiences. This enables separate sites for different user groups (e.g., internal developers, beta testers, public customers).
86+
87+
Content is filtered based on audience tags:
88+
89+
- **Match**: Content with an audience matching the instance audience is included
90+
- **No match**: Content with a non-matching audience is excluded
91+
- **No audience**: Content without an audience tag is included by default
92+
93+
Define audiences for instances and versions in `docs.yml`:
94+
95+
<CodeBlock title="docs.yml">
96+
97+
```yaml maxLines=10
98+
instances:
99+
- url: internal.docs.buildwithfern.com
100+
audiences:
101+
- internal # Only shows content tagged with 'internal'
102+
- url: public.docs.buildwithfern.com
103+
audiences:
104+
- public # Only shows content tagged with 'public'
105+
versions:
106+
- display-name: v3
107+
path: ./versions/v3.yml
108+
audiences:
109+
- public # This version only appears on the public instance
110+
- display-name: v2 (Internal)
111+
path: ./versions/v2.yml
112+
audiences:
113+
- internal # This version only appears on the internal instance
114+
```
115+
</CodeBlock>
116+
82117
</Step>
83118
</Steps>
84119

0 commit comments

Comments
 (0)