Skip to content

Commit d311dc4

Browse files
committed
feat: add Gemini to Ask AI dropdown
Added Google Gemini as a fourth AI chat option in the page title dropdown, with deep-link support via gemini.google.com/app.
1 parent 7d78c3c commit d311dc4

File tree

6 files changed

+45
-0
lines changed

6 files changed

+45
-0
lines changed

src/assets/images/gemini.svg

Lines changed: 9 additions & 0 deletions
Loading

src/components/CopyPageButton.astro

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
import claudeIcon from "../assets/images/claude-ai.svg";
33
import chatgptIcon from "../assets/images/chatgpt.svg";
4+
import geminiIcon from "../assets/images/gemini.svg";
45
56
export interface Props {
67
labels: {
@@ -14,6 +15,7 @@ export interface Props {
1415
copyUrlDesc: string;
1516
openInChatGPT: string;
1617
openInClaude: string;
18+
openInGemini: string;
1719
openInPerplexity: string;
1820
aiSection: string;
1921
copySection: string;
@@ -26,6 +28,7 @@ const { labels, pageUrl } = Astro.props;
2628
const aiPrompt = `Read from ${pageUrl} so I can ask questions about it. If there are subpages or important links, read those too. Give a very brief yet holistic and concise tldr, then guess at some questions i might have in the form of FAQ (include your answers or what steps you'd need to do to answer them) too. End by asking me what I'd like to know / do re ${pageUrl} specifically, noting key subpages and important links`;
2729
const claudeUrl = `https://claude.ai/new?q=${encodeURIComponent(aiPrompt)}`;
2830
const chatgptUrl = `https://chat.openai.com/?q=${encodeURIComponent(aiPrompt)}&hints=search`;
31+
const geminiUrl = `https://gemini.google.com/app?q=${encodeURIComponent(aiPrompt)}`;
2932
const perplexityUrl = `https://www.perplexity.ai/?q=${encodeURIComponent(`Help me understand this Aptos documentation page: ${pageUrl}`)}`;
3033
---
3134

@@ -140,6 +143,35 @@ const perplexityUrl = `https://www.perplexity.ai/?q=${encodeURIComponent(`Help m
140143
</svg>
141144
</a>
142145

146+
<a
147+
class="menu-item"
148+
role="menuitem"
149+
href={geminiUrl}
150+
target="_blank"
151+
rel="noopener noreferrer"
152+
>
153+
<img src={geminiIcon.src} alt="Gemini" width="16" height="16" />
154+
<div class="menu-item-text">
155+
<span class="menu-item-label">{labels.openInGemini}</span>
156+
</div>
157+
<svg
158+
class="icon-external"
159+
xmlns="http://www.w3.org/2000/svg"
160+
width="12"
161+
height="12"
162+
viewBox="0 0 24 24"
163+
fill="none"
164+
stroke="currentColor"
165+
stroke-width="2"
166+
stroke-linecap="round"
167+
stroke-linejoin="round"
168+
>
169+
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
170+
<polyline points="15 3 21 3 21 9"></polyline>
171+
<line x1="10" y1="14" x2="21" y2="3"></line>
172+
</svg>
173+
</a>
174+
143175
<a
144176
class="menu-item"
145177
role="menuitem"

src/content/i18n-schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export const AstroDocsI18nSchema = z
8383
"copyPage.copyUrlDesc": z.string(),
8484
"copyPage.openInChatGPT": z.string(),
8585
"copyPage.openInClaude": z.string(),
86+
"copyPage.openInGemini": z.string(),
8687
"copyPage.openInPerplexity": z.string(),
8788
"copyPage.aiSection": z.string(),
8889
"copyPage.copySection": z.string(),

src/content/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"copyPage.copyUrlDesc": "Share this page link",
1212
"copyPage.openInChatGPT": "Open in ChatGPT",
1313
"copyPage.openInClaude": "Open in Claude",
14+
"copyPage.openInGemini": "Open in Gemini",
1415
"copyPage.openInPerplexity": "Open in Perplexity",
1516
"copyPage.aiSection": "Discuss this page",
1617
"copyPage.copySection": "Copy content",

src/content/i18n/zh.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"copyPage.copyUrlDesc": "分享此页面链接",
1212
"copyPage.openInChatGPT": "在 ChatGPT 中打开",
1313
"copyPage.openInClaude": "在 Claude 中打开",
14+
"copyPage.openInGemini": "在 Gemini 中打开",
1415
"copyPage.openInPerplexity": "在 Perplexity 中打开",
1516
"copyPage.aiSection": "讨论此页面",
1617
"copyPage.copySection": "复制内容",

src/starlight-overrides/PageTitle.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const pageUrl = Astro.url.href;
3030
copyUrlDesc: t("copyPage.copyUrlDesc"),
3131
openInChatGPT: t("copyPage.openInChatGPT"),
3232
openInClaude: t("copyPage.openInClaude"),
33+
openInGemini: t("copyPage.openInGemini"),
3334
openInPerplexity: t("copyPage.openInPerplexity"),
3435
aiSection: t("copyPage.aiSection"),
3536
copySection: t("copyPage.copySection"),

0 commit comments

Comments
 (0)