Skip to content

Commit ba47263

Browse files
committed
add more conceptual info to personalization
1 parent 6af6398 commit ba47263

File tree

1 file changed

+59
-2
lines changed

1 file changed

+59
-2
lines changed

authentication-personalization/personalization-setup.mdx

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,65 @@ description: "Let users log in for customized documentation experiences"
44
icon: "user-cog"
55
---
66

7-
Customize your documentation based on user information, including prefilling API playground inputs and adding dynamic content.
7+
Personalization customizes your documentation for each user when they are logged in. For example, you can prefill their API keys, show content specific to their plan or role, or hide sections they don't need access to.
8+
9+
## Personalized content
10+
11+
Personalization allows you to customize content with these features.
12+
13+
### API key prefilling
14+
15+
Automatically populate API playground fields with user-specific values by returning matching field names in your user data. The field names in your user data must exactly match the names in the API playground for automatic prefilling to work.
16+
17+
### Dynamic MDX content
18+
19+
Display dynamic content based on user information like name, plan, or organization.
20+
21+
The `user` variable contains information sent to your docs from logged in users. See the [User data format](#user-data-format) section below for more information.
22+
23+
**Example**: Hello, {user.name ?? 'reader'}!
24+
25+
```jsx
26+
Hello, {user.name ?? 'reader'}!
27+
```
28+
29+
This feature is more powerful when you pair it with custom data about your users. For example, you can give different instructions based on a user's plan.
30+
31+
**Example**: Authentication is an enterprise feature. {
32+
user.org === undefined
33+
? <>To access this feature, first create an account at the <a href="https://dashboard.mintlify.com/login">Mintlify dashboard</a>.</>
34+
: user.org.plan !== 'enterprise'
35+
? <>You are currently on the ${user.org.plan ?? 'free'} plan. See <a href="https://mintlify.com/pricing">our pricing page</a> for information about upgrading.</>
36+
: <>To request this feature for your enterprise org, contact your admin.</>
37+
}
38+
39+
```jsx
40+
Authentication is an enterprise feature. {
41+
user.org === undefined
42+
? <>To access this feature, first create an account at the <a href="https://dashboard.mintlify.com/login">Mintlify dashboard</a>.</>
43+
: user.org.plan !== 'enterprise'
44+
? <>You are currently on the ${user.org.plan ?? 'free'} plan. See <a href="https://mintlify.com/pricing">our pricing page</a> for information about upgrading.</>
45+
: <>To request this feature for your enterprise org, contact your admin.</>
46+
}
47+
```
48+
49+
<Note>
50+
The information in `user` is only available for logged in users. For logged out users, the value of `user` will be `{}`. To prevent the page from crashing for logged out users, always use optional chaining on your `user` fields. For example, `{user.org?.plan}`.
51+
</Note>
52+
53+
### Page visibility
54+
55+
Restrict which pages are visible to your users by adding `groups` fields to your pages' frontmatter. By default, every page is visible to every user.
56+
57+
Users will only see pages for `groups` that they are in.
58+
59+
```mdx
60+
---
61+
title: "Managing your users"
62+
description: "Adding and removing users from your organization"
63+
groups: ["admin"]
64+
---
65+
```
866
967
## User data format
1068
@@ -306,4 +364,3 @@ No CORS configuration is needed since the dashboard and docs share the same doma
306364
</Note>
307365
</Tab>
308366
</Tabs>
309-

0 commit comments

Comments
 (0)