Skip to content

Commit a6d7946

Browse files
committed
move longer example to later in page
1 parent ba47263 commit a6d7946

File tree

1 file changed

+26
-37
lines changed

1 file changed

+26
-37
lines changed

authentication-personalization/personalization-setup.mdx

Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,23 @@ icon: "user-cog"
66

77
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.
88

9-
## Personalized content
9+
## Personalization features
1010

11-
Personalization allows you to customize content with these features.
11+
Customize content with these personalization capabilities.
1212

1313
### API key prefilling
1414

1515
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.
1616

1717
### Dynamic MDX content
1818

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-
}
19+
Display dynamic content based on user information like name, plan, or organization using the `user` variable.
3820

3921
```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-
}
22+
Welcome back, {user.firstName}! Your {user.org?.plan} plan includes...
4723
```
4824
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>
25+
See the [User data format](#user-data-format) section below for detailed examples and implementation guidance.
5226
5327
### Page visibility
5428
@@ -103,7 +77,7 @@ type User = {
10377
>
10478
Custom data accessible in your `MDX` content via the `user` variable. Use this for dynamic personalization throughout your documentation.
10579
106-
**Example**:
80+
**Basic example**:
10781
```json
10882
{ "firstName": "Ronan", "company": "Acme Corp", "plan": "Enterprise" }
10983
```
@@ -113,6 +87,21 @@ type User = {
11387
Welcome back, {user.firstName}! Your {user.plan} plan includes...
11488
```
11589
With the example `user` data, this would render as: Welcome back, Ronan! Your Enterprise plan includes...
90+
91+
**Advanced conditional rendering**:
92+
```jsx
93+
Authentication is an enterprise feature. {
94+
user.org === undefined
95+
? <>To access this feature, first create an account at the <a href="https://dashboard.mintlify.com/login">Mintlify dashboard</a>.</>
96+
: user.org.plan !== 'enterprise'
97+
? <>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.</>
98+
: <>To request this feature for your enterprise org, contact your admin.</>
99+
}
100+
```
101+
102+
<Note>
103+
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}`.
104+
</Note>
116105
</ParamField>
117106
<ParamField
118107
path="apiPlaygroundInputs"
@@ -167,8 +156,8 @@ Select the handshake method that you want to configure.
167156
<Tab title="JWT">
168157
### Prerequisites
169158
170-
* A login system that can generate and sign JWTs.
171-
* A backend service that can create redirect URLs.
159+
* A login system that can generate and sign JWTs
160+
* A backend service that can create redirect URLs
172161
173162
### Implementation
174163
@@ -184,7 +173,7 @@ Select the handshake method that you want to configure.
184173
<Step title="Integrate Mintlify personalization into your login flow.">
185174
Modify your existing login flow to include these steps after user login:
186175
187-
* Create a JWT containing the logged in user's info in the `User` format. See the [User data format](#user-data-format) section above for more information.
176+
* Create a JWT containing the logged-in user's info in the `User` format. See the [User data format](#user-data-format) section above for more information.
188177
* Sign the JWT with the secret key, using the ES256 algorithm.
189178
* Create a redirect URL back to your docs, including the JWT as the hash.
190179
</Step>
@@ -238,8 +227,8 @@ To redirect users to specific sections after login, use this URL format: `https:
238227
</Tab>
239228
<Tab title="OAuth 2.0">
240229
### Prerequisites
241-
* An OAuth server that supports the Auth Code with PKCE Flow.
242-
* Ability to create an API endpoint accessible by OAuth access tokens.
230+
* An OAuth server that supports the Auth Code with PKCE Flow
231+
* Ability to create an API endpoint accessible by OAuth access tokens
243232
244233
### Implementation
245234
<Steps>

0 commit comments

Comments
 (0)