diff --git a/apify-docs-theme/src/theme/LLMButtons/index.jsx b/apify-docs-theme/src/theme/LLMButtons/index.jsx index 0a989935b..4e0aa6439 100644 --- a/apify-docs-theme/src/theme/LLMButtons/index.jsx +++ b/apify-docs-theme/src/theme/LLMButtons/index.jsx @@ -2,6 +2,7 @@ import clsx from 'clsx'; import React, { useCallback, useState } from 'react'; import { + AnthropicIcon, ChatGptIcon, CheckIcon, ChevronDownIcon, @@ -37,6 +38,13 @@ const DROPDOWN_OPTIONS = [ Icon: ChatGptIcon, value: 'openInChatGPT', }, + { + label: 'Open in Claude', + description: 'Ask questions about this page', + showExternalIcon: true, + Icon: AnthropicIcon, + value: 'openInClaude', + }, { label: 'Open in Perplexity', description: 'Ask questions about this page', @@ -70,6 +78,27 @@ const onOpenInChatGPTClick = () => { } }; +const onOpenInClaudeClick = () => { + if (window.analytics) { + window.analytics.track('Clicked', { + app: 'docs', + button_text: 'Open in Claude', + element: 'llm-buttons.openInClaude', + }); + } + + const prompt = getPrompt(window.location.href); + + try { + window.open( + `https://claude.ai/new?q=${encodeURIComponent(prompt)}`, + '_blank', + ); + } catch (error) { + console.error('Error opening Claude:', error); + } +}; + const onOpenInPerplexityClick = () => { if (window.analytics) { window.analytics.track('Clicked', { @@ -227,6 +256,9 @@ export default function LLMButtons({ isApiReferencePage = false }) { case 'openInChatGPT': onOpenInChatGPTClick(); break; + case 'openInClaude': + onOpenInClaudeClick(); + break; case 'openInPerplexity': onOpenInPerplexityClick(); break;