Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 35 additions & 14 deletions reusable-snippets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,29 @@ icon: 'recycle'
---

One of the core principles of software development is DRY (Don't Repeat
Yourself). This is a principle that applies to documentation as
Yourself), which applies to documentation as
well. If you find yourself repeating the same content in multiple places, you
should consider creating a custom snippet to keep your content in sync.
should create a custom snippet to keep your content in sync.

## Creating a custom snippet

**Pre-condition**: You must create your snippet file in the `snippets` directory.
**Pre-condition**: You must create your snippet file in the `snippets` directory in order for the import to work.

<Note>
Any page in the `snippets` directory will be treated as a snippet and will not
be rendered into a standalone page. If you want to create a standalone page
from the snippet, import the snippet into another file and call it as a
component.
</Note>


### Default export

1. Add content to your snippet file that you want to re-use across multiple
locations. Optionally, you can add variables that can be filled in via props
when you import the snippet.
1. Add content to your snippet file that you want to re-use. Optionally, you can add variables that can be filled in via props
when you import the snippet. In this example, our variable is word.

```typescript snippets/my-snippet.mdx
Hello world! This is my content I want to reuse across pages. My keyword of the
day is {word}.
Hello world! This is my content I want to reuse across pages.
```

<Warning>
The content that you want to reuse must be inside the `snippets` directory in
order for the import to work.
</Warning>

2. Import the snippet into your destination file.

Expand All @@ -50,7 +43,35 @@ import MySnippet from '/snippets/path/to/my-snippet.mdx';

Lorem impsum dolor sit amet.

<MySnippet/>

```

### Exporting with variables

1. Optionally, you can add variables that can be filled in via props when you import the snippet. In this example, our variable is word.

```typescript snippets/my-snippet.mdx
My keyword of the day is {word}.
```


2. Import the snippet into your destination file with the variable. The property will fill in based on your specification.

```typescript destination-file.mdx
---
title: My title
description: My Description
---

import MySnippet from '/snippets/path/to/my-snippet.mdx';

## Header

Lorem impsum dolor sit amet.

<MySnippet word="bananas" />

```

### Reusable variables
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
---
title: 'Password Handshake'
description: 'Use a set of shared passwords to authenticate users'
title: "Password Handshake"
description: "Use a set of shared passwords to authenticate users"
---

<Info>
This is the documentation for the Password **Authentication** Handshake. The Password Handshake is not available for Personalization.
This is the documentation for the Password **Authentication** Handshake. The
Password Handshake is not available for Personalization.
</Info>

If you don't have strict security requirements, or you don't want to manage a
database of documentation readers, you can use a set of shared passwords to
protect your docs.

<Note>
Authentication is available only by request. Please <a href="mailto:[email protected]">contact our sales team</a> for access. After we've enabled access, you can follow the implementation instructions.
Authentication is available only by request. Please{" "}
<a href="mailto:[email protected]">contact our sales team</a> for access.
After we've enabled access, you can follow the implementation instructions.
</Note>

## Implementation

<Steps>
<Step title="Add a password">
Go to your [Mintlify dashboard settings](https://dashboard.mintlify.com/products/authentication) and create a password.
Go to your [dashboard
settings](https://dashboard.mintlify.com/products/authentication) and create
a password.
</Step>
<Step title="Share your password">
Securely share the password with your documentation readers. That's it!
Expand Down
5 changes: 0 additions & 5 deletions settings/authentication-personalization/authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ title: "Authentication"
description: "Guarantee privacy of your docs by authenticating users"
---

<Note>
Authentication is an enterprise feature. To get access, [contact
sales](mailto:[email protected]).
</Note>

Authentication offers full privacy for all of your
documentation content by requiring users to authenticate before viewing any content, such as:

Expand Down
36 changes: 19 additions & 17 deletions settings/authentication-personalization/personalization.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
---
title: 'Personalization'
description: 'A list of features unlocked with Personalization'
title: "Personalization"
description: "A list of features unlocked with Personalization"
---

<Note>
Personalization is an enterprise feature. To get access, [contact sales](mailto:[email protected]).
</Note>

Personalization refers to a suite of features that allow you to customize your
documentation experience based on some information about the user. There are
three major features of Personalization:
Expand Down Expand Up @@ -35,8 +31,8 @@ Personalization is an enterprise feature. {
user.org === undefined
? <>To access this feature, first create an account at the <a href="https://dashboard.mintlify.com/login">Mintlify dashboard</a>.</>
: user.org.plan !== 'enterprise'
? <>You are currently on the ${user.org.plan ?? 'free'} plan. To speak to our team about upgrading, <a href="mailto:[email protected]">contact our sales team</a>.</>
: <>To request this feature for your enterprise org, <a href="mailto:[email protected]">contact our team</a>.</>
? <>You are currently on the ${user.org.plan ?? 'free'} plan. To speak to our team about upgrading, <a href="mailto:[email protected]">contact our sales team</a>.</>
: <>To request this feature for your enterprise org, <a href="mailto:[email protected]">contact our team</a>.</>
}

```jsx
Expand All @@ -50,7 +46,10 @@ Personalization is an enterprise feature. {
```

<Note>
The information in `user` is only available after a user has logged in. 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, e.g. `{user.org?.plan}`
The information in `user` is only available after a user has logged in. 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, e.g. `{user.org?.plan}`
</Note>

### Prefilling API Keys
Expand All @@ -65,18 +64,21 @@ If the user is not in any of the groups listed in the page metadata, the page wi

```md
---
title: 'Managing Your Users'
description: 'Adding and removing users from your organization'
groups: ['admin']
title: "Managing Your Users"
description: "Adding and removing users from your organization"
groups: ["admin"]
---
```

Here's a table that displays whether a page is shown for different combinations of `groups` in User and page metadata:

| | `groups` not in User | `groups: []` in User | `groups: ['admin']` in User |
| :------------------------------ | :----------------------: | :----------------------: | :-----------------------------: |
| `groups` not in metadata | | | |
| `groups: []` in metadata | | | |
| `groups: ['admin']` in metadata | | | |
| :------------------------------ | :------------------: | :------------------: | :-------------------------: |
| `groups` not in metadata | ✅ | ✅ | |
| `groups: []` in metadata | ❌ | ❌ | |
| `groups: ['admin']` in metadata | ❌ | ❌ | |

<Note>Note that an empty array in the page metadata is interpreted as "No groups should see this page."</Note>
<Note>
Note that an empty array in the page metadata is interpreted as "No groups
should see this page."
</Note>
Loading