Skip to content

Commit 4a2308e

Browse files
dks333ethanpalm
andauthored
add custom option in context menu (#892)
* add custom option in context menu * review edits * fix link --------- Co-authored-by: Ethan Palm <[email protected]>
1 parent ac7aa76 commit 4a2308e

File tree

1 file changed

+69
-1
lines changed

1 file changed

+69
-1
lines changed

ai-ingestion.mdx

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const PreviewButton = ({ children, href }) => {
1212
)
1313
}
1414

15-
Mintlify generates optimized formats and provides shortcuts that help users get faster, more accurate responses when using your documentation as context for LLMs and AI tools.
15+
Generate optimized formats and provide shortcuts that help users get faster, more accurate responses when using your documentation as context for LLMs and AI tools.
1616

1717
## Contextual menu
1818

@@ -22,6 +22,7 @@ Provide quick access to AI-optimized content and direct integrations with popula
2222
* **View as Markdown**: Opens the current page as Markdown.
2323
* **Open in ChatGPT**: Creates a ChatGPT conversation with the current page as context.
2424
* **Open in Claude**: Creates a Claude conversation with the current page as context.
25+
* [**Your custom options**](#adding-custom-options): Add your own options to the contextual menu.
2526

2627
<Frame>
2728
<img
@@ -47,6 +48,73 @@ Add the `contextual` field to your `docs.json` and specify which options you wan
4748
}
4849
```
4950

51+
### Adding custom options
52+
53+
Create custom options in the contextual menu by adding an object to the `options` array. Each custom option requires these properties:
54+
55+
<ResponseField name="title" type="string" required>
56+
The title of the option.
57+
</ResponseField>
58+
59+
<ResponseField name="description" type="string" required>
60+
The description of the option. Displayed beneath the title when the contextual menu is expanded.
61+
</ResponseField>
62+
63+
<ResponseField name="icon" type="string" required>
64+
The icon of the option. Accepts any icon from the [Icons](/components/icons) collection.
65+
</ResponseField>
66+
67+
<ResponseField name="href" type="string | object" required>
68+
The href of the option. Use a string for simple links or an object for dynamic links with query parameters.
69+
70+
<Expandable title="href object">
71+
<ResponseField name="base" type="string" required>
72+
The base URL for the option.
73+
</ResponseField>
74+
75+
<ResponseField name="query" type="object" required>
76+
The query parameters for the option.
77+
78+
<Expandable title="query object">
79+
<ResponseField name="key" type="string" required>
80+
The query parameter key.
81+
</ResponseField>
82+
83+
<ResponseField name="value" type="string" required>
84+
The query parameter value. Use `$page` to insert the current page content in Markdown or `$path` to insert the current page path.
85+
</ResponseField>
86+
</Expandable>
87+
</ResponseField>
88+
</Expandable>
89+
</ResponseField>
90+
91+
Example custom option:
92+
93+
```json {7-20} Example with Perplexity icon="search"
94+
"contextual": {
95+
"options": [
96+
"copy",
97+
"view",
98+
"chatgpt",
99+
"claude",
100+
{
101+
"title": "Ask Perplexity",
102+
"description": "Ask Perplexity about the current page",
103+
"icon": "search",
104+
"href": {
105+
"base": "https://www.perplexity.ai/search",
106+
"query": [
107+
{
108+
"key": "q",
109+
"value": "Ask question about https://mintlify.com/docs$path.md"
110+
}
111+
]
112+
}
113+
}
114+
]
115+
}
116+
```
117+
50118
## /llms.txt
51119

52120
The [/llms.txt file](https://llmstxt.org) is an industry standard that helps general-purpose LLMs index more efficiently, similar to how a sitemap helps search engines.

0 commit comments

Comments
 (0)