@apify/docs-theme 1.0.217 → 1.0.219
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/absoluteUrl.js +11 -0
- package/src/config.js +1 -10
- package/src/theme/LLMButtons/index.jsx +32 -0
- package/src/theme/Layout/index.jsx +3 -1
package/package.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
let absoluteUrl = 'https://docs.apify.com';
|
|
2
|
+
|
|
3
|
+
if (process.env.LOCALHOST) {
|
|
4
|
+
absoluteUrl = 'http://localhost:3000';
|
|
5
|
+
} else if (process.env.DEV) {
|
|
6
|
+
absoluteUrl = 'http://docs.apify.loc';
|
|
7
|
+
} else if (process.env.APIFY_DOCS_ABSOLUTE_URL) {
|
|
8
|
+
absoluteUrl = process.env.APIFY_DOCS_ABSOLUTE_URL;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
exports.absoluteUrl = absoluteUrl;
|
package/src/config.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
/* eslint-disable global-require */
|
|
2
|
-
|
|
3
|
-
let absoluteUrl = 'https://docs.apify.com';
|
|
4
|
-
|
|
5
|
-
if (process.env.LOCALHOST) {
|
|
6
|
-
absoluteUrl = 'http://localhost:3000';
|
|
7
|
-
} else if (process.env.DEV) {
|
|
8
|
-
absoluteUrl = 'http://docs.apify.loc';
|
|
9
|
-
} else if (process.env.APIFY_DOCS_ABSOLUTE_URL) {
|
|
10
|
-
absoluteUrl = process.env.APIFY_DOCS_ABSOLUTE_URL;
|
|
11
|
-
}
|
|
2
|
+
const { absoluteUrl } = require('./absoluteUrl');
|
|
12
3
|
|
|
13
4
|
const noIndex = ['true', '1'].includes(process.env.NO_INDEX ?? '');
|
|
14
5
|
|
|
@@ -2,6 +2,7 @@ import clsx from 'clsx';
|
|
|
2
2
|
import React, { useCallback, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
+
AnthropicIcon,
|
|
5
6
|
ChatGptIcon,
|
|
6
7
|
CheckIcon,
|
|
7
8
|
ChevronDownIcon,
|
|
@@ -37,6 +38,13 @@ const DROPDOWN_OPTIONS = [
|
|
|
37
38
|
Icon: ChatGptIcon,
|
|
38
39
|
value: 'openInChatGPT',
|
|
39
40
|
},
|
|
41
|
+
{
|
|
42
|
+
label: 'Open in Claude',
|
|
43
|
+
description: 'Ask questions about this page',
|
|
44
|
+
showExternalIcon: true,
|
|
45
|
+
Icon: AnthropicIcon,
|
|
46
|
+
value: 'openInClaude',
|
|
47
|
+
},
|
|
40
48
|
{
|
|
41
49
|
label: 'Open in Perplexity',
|
|
42
50
|
description: 'Ask questions about this page',
|
|
@@ -70,6 +78,27 @@ const onOpenInChatGPTClick = () => {
|
|
|
70
78
|
}
|
|
71
79
|
};
|
|
72
80
|
|
|
81
|
+
const onOpenInClaudeClick = () => {
|
|
82
|
+
if (window.analytics) {
|
|
83
|
+
window.analytics.track('Clicked', {
|
|
84
|
+
app: 'docs',
|
|
85
|
+
button_text: 'Open in Claude',
|
|
86
|
+
element: 'llm-buttons.openInClaude',
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const prompt = getPrompt(window.location.href);
|
|
91
|
+
|
|
92
|
+
try {
|
|
93
|
+
window.open(
|
|
94
|
+
`https://claude.ai/new?q=${encodeURIComponent(prompt)}`,
|
|
95
|
+
'_blank',
|
|
96
|
+
);
|
|
97
|
+
} catch (error) {
|
|
98
|
+
console.error('Error opening Claude:', error);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
73
102
|
const onOpenInPerplexityClick = () => {
|
|
74
103
|
if (window.analytics) {
|
|
75
104
|
window.analytics.track('Clicked', {
|
|
@@ -227,6 +256,9 @@ export default function LLMButtons({ isApiReferencePage = false }) {
|
|
|
227
256
|
case 'openInChatGPT':
|
|
228
257
|
onOpenInChatGPTClick();
|
|
229
258
|
break;
|
|
259
|
+
case 'openInClaude':
|
|
260
|
+
onOpenInClaudeClick();
|
|
261
|
+
break;
|
|
230
262
|
case 'openInPerplexity':
|
|
231
263
|
onOpenInPerplexityClick();
|
|
232
264
|
break;
|
|
@@ -6,6 +6,8 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
|
6
6
|
import { usePluginData } from '@docusaurus/useGlobalData';
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
|
+
import { absoluteUrl } from '../../absoluteUrl';
|
|
10
|
+
|
|
9
11
|
export default function LayoutWrapper(props) {
|
|
10
12
|
const { options: { subNavbar } } = usePluginData('@apify/docs-theme');
|
|
11
13
|
const baseUrl = useBaseUrl('/');
|
|
@@ -17,7 +19,7 @@ export default function LayoutWrapper(props) {
|
|
|
17
19
|
<Head>
|
|
18
20
|
{
|
|
19
21
|
shouldRenderAlternateLink
|
|
20
|
-
? <link rel="alternate" type="text/markdown" href={`${currentPath}.md`}/>
|
|
22
|
+
? <link rel="alternate" type="text/markdown" href={`${absoluteUrl}/${currentPath}.md`}/>
|
|
21
23
|
: null
|
|
22
24
|
}
|
|
23
25
|
</Head>
|