@devries-cameron20 / composio Mirror · read-only / commits / cb5204802
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 12:15 UTC

fix(docs): keep toolkit titles and the home card count stable across pages

- only catalog toolkit pages ("<Name> - Composio Toolkit") get the "<Name> Toolkit" card title; the toolkits index and MDX guides keep their own titles instead of "Toolkits Toolkit" - the home card description is a shared constant used by the URL builder, so the /docs index page and the root layout produce the same image URL and the live app count is never dropped - update the integration expectation from ?variant=home to the new section=home URL Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Malay Vasa committed Sep 16, 2026 at 20:12 UTC cb520480286a7a18d2a1e53f2bcb439a523e583c
6 files changed +40 -12
docs/app/api/og/route.tsx
+14 -2
@@ -295,8 +295,20 @@ function DocsCard({ p, ctx: { c } }: CardProps) {
295 );
296 }
297
298 +const TOOLKIT_SUFFIX = /\s*-\s*Composio Toolkit\s*$/i;
299 +
300 +/**
301 + * Catalog toolkit pages title themselves "<Name> - Composio Toolkit"; the card
302 + * shows "<Name> Toolkit". Any other page in the section (the index, MDX
303 + * guides like "Premium Tools") keeps its title as written.
304 + */
305 +export function toolkitCardTitle(title: string): string {
306 + return TOOLKIT_SUFFIX.test(title) ? `${title.replace(TOOLKIT_SUFFIX, '')} Toolkit` : title;
307 +}
308 +
309 function ToolkitCard({ p, ctx: { c, brand } }: CardProps) {
299 - const name = p.title.replace(/\s*-\s*Composio Toolkit\s*$/i, '');
310 + const name = p.title.replace(TOOLKIT_SUFFIX, '');
311 + const title = toolkitCardTitle(p.title);
312 return (
313 <Stack>
314 {p.logo ? (
@@ -310,7 +322,7 @@ function ToolkitCard({ p, ctx: { c, brand } }: CardProps) {
322 </Node>
323 </div>
324 ) : null}
313 - <Title size={titleSize(`${name} Toolkit`, 64)} c={c}>{`${name} Toolkit`}</Title>
325 + <Title size={titleSize(title, 64)} c={c}>{title}</Title>
326 <Description c={c}>{p.description || `Connect your AI agent to ${name} with Composio.`}</Description>
327 </Stack>
328 );
docs/app/layout.tsx
+1 -4
@@ -9,7 +9,7 @@ import { PostHogProvider } from '@/components/posthog-provider';
9 import CustomSearchDialog from '@/components/custom-search-dialog';
10 import { ScrollReset } from '@/components/scroll-reset';
11 import { source, referenceSource, getOgImageUrl } from '@/lib/source';
12 -import { TOOLKIT_COUNT_LABEL } from '@/lib/toolkit-count';
12 +import { TOOLKIT_COUNT_LABEL, HOME_OG_DESCRIPTION } from '@/lib/toolkit-count';
13 import { ProductTransitionLoader } from '@/components/product-transition-loader';
14 import { DocsProductProvider } from '@/components/docs-product-context';
15 import {
@@ -35,9 +35,6 @@ const defaultLinks = defaultLinkSlugs.flatMap(({ slug, source: pageSource }) =>
35 });
36
37 const SITE_DESCRIPTION = `Build AI agents with ${TOOLKIT_COUNT_LABEL} tools. Connect LLMs to external services like GitHub, Slack, Gmail, and more.`;
38 -// Social card copy for the docs homepage. Counts apps rather than tools so it
39 -// matches the wording on the landing page.
40 -const HOME_OG_DESCRIPTION = `Build AI agents with ${TOOLKIT_COUNT_LABEL} apps. Connect LLMs to external services like GitHub, Slack, Gmail, and more.`;
38 const HOME_OG_IMAGE = getOgImageUrl('docs', [], 'Composio Docs', HOME_OG_DESCRIPTION);
39
40 export const metadata: Metadata = {
docs/lib/source.ts
+4 -1
@@ -24,6 +24,7 @@ import { PACKAGE_MANAGERS } from './package-install';
24 import { z } from 'zod';
25 import { promptFor, SETUP_PROMPT } from './agent-prompts';
26 import { AGENTS } from './agent-setup-clients';
27 +import { HOME_OG_DESCRIPTION } from './toolkit-count';
28
29 /**
30 * True if a reference URL belongs to an intentionally-hidden API tag
@@ -180,8 +181,10 @@ export function getOgImageUrl(
181 ): string {
182 const params = new URLSearchParams();
183 if (section === 'docs' && slugs.length === 0) {
184 + // The home card has fixed copy; the page's own description is ignored so
185 + // the root layout and the /docs index page produce the same image URL.
186 params.set('section', 'home');
184 - if (description) params.set('description', description);
187 + params.set('description', HOME_OG_DESCRIPTION);
188 return `${OG_ROUTE}?${params.toString()}`;
189 }
190 const isChangelog = section === 'docs' && slugs[0] === 'changelog';
docs/lib/toolkit-count.ts
+5
@@ -9,3 +9,8 @@ const roundedToolkitCount = Math.floor(toolkitsData.length / 100) * 100;
9 // Pin the locale so the grouping separator is a comma regardless of the build
10 // host's locale ("1,300+", never "1.300+" or "1 300+").
11 export const TOOLKIT_COUNT_LABEL = `${roundedToolkitCount.toLocaleString('en-US')}+`;
12 +
13 +// Copy for the docs homepage social card. Counts apps rather than tools so
14 +// it matches the landing page. Every route that builds the home-card URL
15 +// uses this, so the live count survives whichever page sets the metadata.
16 +export const HOME_OG_DESCRIPTION = `Build AI agents with ${TOOLKIT_COUNT_LABEL} apps. Connect LLMs to external services like GitHub, Slack, Gmail, and more.`;
docs/tests/integration/rendering.test.ts
+2 -2
@@ -66,8 +66,8 @@ describe("Page rendering - content markers", () => {
66 expect(html).toContain('<title>Build and operate AI agents | Composio Documentation</title>');
67 expect(html).toContain('<meta property="og:site_name" content="Composio Docs"');
68 expect(html).toContain('<meta property="og:title" content="Build and operate AI agents"');
69 - expect(html).toContain('<meta property="og:image" content="https://docs.composio.dev/api/og?variant=home"');
70 - expect(html).toContain('<meta name="twitter:image" content="https://docs.composio.dev/api/og?variant=home"');
69 + expect(html).toContain('<meta property="og:image" content="https://docs.composio.dev/api/og?section=home&amp;description=');
70 + expect(html).toContain('<meta name="twitter:image" content="https://docs.composio.dev/api/og?section=home&amp;description=');
71 const description = html.match(/<meta property="og:description" content="([^"]+)"/)?.[1];
72 expect(description).toBe('Give your agents tools, managed authentication, and secure execution. Get started with the SDK, CLI, or MCP.');
73 expect(description!.length).toBeLessThanOrEqual(125);
docs/tests/static/og-image.test.ts
+14 -3
@@ -1,6 +1,7 @@
1 import { expect, test } from 'bun:test';
2 -import { GET, parseOgParams } from '../../app/api/og/route';
2 +import { GET, parseOgParams, toolkitCardTitle } from '../../app/api/og/route';
3 import { getOgImageUrl } from '../../lib/source';
4 +import { HOME_OG_DESCRIPTION } from '../../lib/toolkit-count';
5
6 async function expectPng(url: string) {
7 const response = await GET(new Request(url));
@@ -32,9 +33,12 @@ test('every section renders its own card', async () => {
33 });
34
35 test('the URL builder names the section and forwards extras', () => {
35 - const home = new URL(getOgImageUrl('docs', [], 'Welcome', 'desc'));
36 + // Both the root layout and the /docs index page build this URL; the home
37 + // card ignores the page description so they agree and carry the live count.
38 + const home = new URL(getOgImageUrl('docs', [], 'Welcome', 'page description'));
39 expect(home.searchParams.get('section')).toBe('home');
37 - expect(home.searchParams.get('description')).toBe('desc');
40 + expect(home.searchParams.get('description')).toBe(HOME_OG_DESCRIPTION);
41 + expect(HOME_OG_DESCRIPTION).toMatch(/^Build AI agents with [\d,]+\+ apps\./);
42
43 const changelog = new URL(getOgImageUrl('docs', ['changelog', '2026', '09', '04'], 'Title', 'Updates', { date: 'Sep 4, 2026' }));
44 expect(changelog.searchParams.get('section')).toBe('changelog');
@@ -76,3 +80,10 @@ test('cards default to the dark surface and accept theme=light', async () => {
80 await expectPng('https://docs.composio.dev/api/og?section=toolkits&title=GitHub&theme=light');
81 await expectPng('https://docs.composio.dev/api/og?section=home&theme=light');
82 });
83 +
84 +test('only catalog toolkit titles get the Toolkit suffix', () => {
85 + expect(toolkitCardTitle('GitHub - Composio Toolkit')).toBe('GitHub Toolkit');
86 + expect(toolkitCardTitle('Google Sheets - Composio Toolkit')).toBe('Google Sheets Toolkit');
87 + expect(toolkitCardTitle('Toolkits')).toBe('Toolkits');
88 + expect(toolkitCardTitle('Premium Tools')).toBe('Premium Tools');
89 +});