The best way to control Claude Code, Codex and more from any computer or phone

main
ts 79 lines 2.73 KB
Raw
1 import { ANDROID_PLAY_STORE_URL, GITHUB_REPOSITORY_URL, IOS_APP_STORE_URL } from "./site";
2
3 export const SITE_ORIGIN = "https://t3.codes";
4 export const SITE_NAME = "T3 Code";
5 export const SITE_TAGLINE = "The open-source control plane for coding agents";
6
7 // The canonical set of official properties. Search engines and AI answer engines read `sameAs`
8 // to tie an entity to its real homes, which is the signal a look-alike domain cannot copy.
9 export const OFFICIAL_PROFILES = [
10 GITHUB_REPOSITORY_URL,
11 IOS_APP_STORE_URL,
12 ANDROID_PLAY_STORE_URL,
13 "https://discord.gg/jn4EGJjrvv",
14 ] as const;
15
16 export type JsonLd = Record<string, unknown>;
17
18 const ORGANIZATION_ID = `${SITE_ORIGIN}/#organization`;
19 const WEBSITE_ID = `${SITE_ORIGIN}/#website`;
20 const SOFTWARE_ID = `${SITE_ORIGIN}/#software`;
21
22 export const absoluteUrl = (pathname: string): string => new URL(pathname, SITE_ORIGIN).href;
23
24 export const organizationJsonLd = (): JsonLd => ({
25 "@type": "Organization",
26 "@id": ORGANIZATION_ID,
27 name: "T3 Tools Inc",
28 url: SITE_ORIGIN,
29 logo: absoluteUrl("/apple-touch-icon.png"),
30 sameAs: ["https://github.com/pingdotgg"],
31 });
32
33 export const websiteJsonLd = (): JsonLd => ({
34 "@type": "WebSite",
35 "@id": WEBSITE_ID,
36 name: SITE_NAME,
37 url: SITE_ORIGIN,
38 publisher: { "@id": ORGANIZATION_ID },
39 });
40
41 export const softwareJsonLd = (description: string): JsonLd => ({
42 "@type": "SoftwareApplication",
43 "@id": SOFTWARE_ID,
44 name: SITE_NAME,
45 description,
46 url: SITE_ORIGIN,
47 downloadUrl: absoluteUrl("/download"),
48 applicationCategory: "DeveloperApplication",
49 operatingSystem: "macOS, Windows, Linux, iOS, Android",
50 license: "https://opensource.org/license/mit",
51 isAccessibleForFree: true,
52 offers: { "@type": "Offer", price: "0", priceCurrency: "USD" },
53 publisher: { "@id": ORGANIZATION_ID },
54 sameAs: [...OFFICIAL_PROFILES],
55 });
56
57 export const breadcrumbJsonLd = (items: ReadonlyArray<{ name: string; path: string }>): JsonLd => ({
58 "@type": "BreadcrumbList",
59 itemListElement: items.map((item, index) => ({
60 "@type": "ListItem",
61 position: index + 1,
62 name: item.name,
63 item: absoluteUrl(item.path),
64 })),
65 });
66
67 export const jsonLdGraph = (nodes: ReadonlyArray<JsonLd>): string =>
68 // `<` is escaped so page text inside the graph can never close the script tag.
69 JSON.stringify({ "@context": "https://schema.org", "@graph": nodes }).replace(/</g, "\\u003c");
70
71 // Indexable static pages. The 404 (noindex) and the /95 easter egg stay out of the sitemap.
72 export const STATIC_PAGES = [
73 { path: "/", priority: "1.0" },
74 { path: "/download", priority: "0.9" },
75 { path: "/legal", priority: "0.3" },
76 { path: "/privacy-policy", priority: "0.3" },
77 { path: "/security-policy", priority: "0.3" },
78 { path: "/terms-of-service", priority: "0.3" },
79 ] as const;