TypeScript
feat(marketing): help search engines tell t3.codes apart from copycat sites (#31142)
Theo Browne59ec1bac9fc2
diff --git a/.github/SECURITY.md b/.github/SECURITY.mdindex 69dc53dc439..56e3f03525e 100644--- a/.github/SECURITY.md+++ b/.github/SECURITY.md@@ -1,7 +1,7 @@# Security policyReport security vulnerabilities affecting T3 Code or T3 Tools-operated infrastructure to-[[email protected]](mailto:[email protected]). Please do not disclose them publicly until we have had+[[email protected]](mailto:[email protected]). Please do not disclose them publicly until we have hada reasonable opportunity to investigate and remediate them.See the [full security policy](https://t3.codes/security-policy) for reporting details, scope,diff --git a/apps/marketing/astro.config.mjs b/apps/marketing/astro.config.mjsindex 15a8a8f9163..338b79c0b8f 100644--- a/apps/marketing/astro.config.mjs+++ b/apps/marketing/astro.config.mjs@@ -8,6 +8,8 @@ delete process.env.VP_RUN_NODE_CLIENT_PATH;export default defineConfig({site: "https://t3.codes",+ // Vercel 308s `/path/` to `/path` (see vercel.ts), so every internal link and canonical uses one form.+ trailingSlash: "never",server: {port: Number(process.env.PORT ?? 4173),},diff --git a/apps/marketing/public/robots.txt b/apps/marketing/public/robots.txtnew file mode 100644index 00000000000..495a72e25e4--- /dev/null+++ b/apps/marketing/public/robots.txt@@ -0,0 +1,4 @@+User-agent: *+Allow: /++Sitemap: https://t3.codes/sitemap.xmldiff --git a/apps/marketing/src/layouts/Layout.astro b/apps/marketing/src/layouts/Layout.astroindex d1aea12f09b..c21c60b1452 100644--- a/apps/marketing/src/layouts/Layout.astro+++ b/apps/marketing/src/layouts/Layout.astro@@ -9,18 +9,25 @@ import {IOS_APP_STORE_URL,MARKETING_STATS,} from "../lib/site";+import { type JsonLd, jsonLdGraph, organizationJsonLd, websiteJsonLd } from "../lib/seo";interface Props {title?: string;description?: string;pageClass?: string;+ /** Page-specific schema.org nodes. Organization and WebSite are always included. */+ jsonLd?: ReadonlyArray<JsonLd>;+ noindex?: boolean;}const {title = "T3 Code",description = "T3 Code. The open-source control plane for coding agents.",pageClass,+ jsonLd = [],+ noindex = false,} = Astro.props;+const structuredData = jsonLdGraph([organizationJsonLd(), websiteJsonLd(), ...jsonLd]);// Link unfurlers require a 1200x630 JPG/PNG at an absolute URL.const socialImage = await getImage({@@ -41,7 +48,7 @@ const canonicalUrl = new URL(Astro.url.pathname, Astro.site);<meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="description" content={description} />- <link rel="canonical" href={canonicalUrl} />+ {noindex ? <meta name="robots" content="noindex" /> : <link rel="canonical" href={canonicalUrl} />}<meta property="og:type" content="website" /><meta property="og:site_name" content="T3 Code" /><meta property="og:url" content={canonicalUrl} />@@ -61,7 +68,9 @@ const canonicalUrl = new URL(Astro.url.pathname, Astro.site);<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32" /><link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16" /><link rel="apple-touch-icon" href="/apple-touch-icon.png" />+ <link rel="sitemap" type="application/xml" href="/sitemap.xml" /><title>{title}</title>+ <script is:inline type="application/ld+json" set:html={structuredData} /></head><body><div class:list={["page", pageClass]}>diff --git a/apps/marketing/src/lib/seo.ts b/apps/marketing/src/lib/seo.tsnew file mode 100644index 00000000000..452d5333868--- /dev/null+++ b/apps/marketing/src/lib/seo.ts@@ -0,0 +1,79 @@+import { ANDROID_PLAY_STORE_URL, GITHUB_REPOSITORY_URL, IOS_APP_STORE_URL } from "./site";++export const SITE_ORIGIN = "https://t3.codes";+export const SITE_NAME = "T3 Code";+export const SITE_TAGLINE = "The open-source control plane for coding agents";++// The canonical set of official properties. Search engines and AI answer engines read `sameAs`+// to tie an entity to its real homes, which is the signal a look-alike domain cannot copy.+export const OFFICIAL_PROFILES = [+ GITHUB_REPOSITORY_URL,+ IOS_APP_STORE_URL,+ ANDROID_PLAY_STORE_URL,+ "https://discord.gg/jn4EGJjrvv",+] as const;++export type JsonLd = Record<string, unknown>;++const ORGANIZATION_ID = `${SITE_ORIGIN}/#organization`;+const WEBSITE_ID = `${SITE_ORIGIN}/#website`;+const SOFTWARE_ID = `${SITE_ORIGIN}/#software`;++export const absoluteUrl = (pathname: string): string => new URL(pathname, SITE_ORIGIN).href;++export const organizationJsonLd = (): JsonLd => ({+ "@type": "Organization",+ "@id": ORGANIZATION_ID,+ name: "T3 Tools Inc",+ url: SITE_ORIGIN,+ logo: absoluteUrl("/apple-touch-icon.png"),+ sameAs: ["https://github.com/pingdotgg"],+});++export const websiteJsonLd = (): JsonLd => ({+ "@type": "WebSite",+ "@id": WEBSITE_ID,+ name: SITE_NAME,+ url: SITE_ORIGIN,+ publisher: { "@id": ORGANIZATION_ID },+});++export const softwareJsonLd = (): JsonLd => ({+ "@type": "SoftwareApplication",+ "@id": SOFTWARE_ID,+ name: SITE_NAME,+ description: `${SITE_NAME}. ${SITE_TAGLINE}.`,+ url: SITE_ORIGIN,+ downloadUrl: absoluteUrl("/download"),+ applicationCategory: "DeveloperApplication",+ operatingSystem: "macOS, Windows, Linux, iOS, Android",+ license: "https://opensource.org/license/mit",+ isAccessibleForFree: true,+ offers: { "@type": "Offer", price: "0", priceCurrency: "USD" },+ publisher: { "@id": ORGANIZATION_ID },+ sameAs: [...OFFICIAL_PROFILES],+});++export const breadcrumbJsonLd = (items: ReadonlyArray<{ name: string; path: string }>): JsonLd => ({+ "@type": "BreadcrumbList",+ itemListElement: items.map((item, index) => ({+ "@type": "ListItem",+ position: index + 1,+ name: item.name,+ item: absoluteUrl(item.path),+ })),+});++export const jsonLdGraph = (nodes: ReadonlyArray<JsonLd>): string =>+ // `<` is escaped so page text inside the graph can never close the script tag.+ JSON.stringify({ "@context": "https://schema.org", "@graph": nodes }).replace(/</g, "\\u003c");++// Indexable static pages. The 404 (noindex) and the /95 easter egg stay out of the sitemap.+export const STATIC_PAGES = [+ { path: "/", priority: "1.0" },+ { path: "/download", priority: "0.9" },+ { path: "/legal", priority: "0.3" },+ { path: "/privacy-policy", priority: "0.3" },+ { path: "/security-policy", priority: "0.3" },+ { path: "/terms-of-service", priority: "0.3" },+] as const;diff --git a/apps/marketing/src/pages/.well-known/security.txt.ts b/apps/marketing/src/pages/.well-known/security.txt.tsnew file mode 100644index 00000000000..9baba40ce82--- /dev/null+++ b/apps/marketing/src/pages/.well-known/security.txt.ts@@ -0,0 +1,19 @@+import type { APIRoute } from "astro";++import { absoluteUrl } from "../../lib/seo";++// RFC 9116 requires an Expires date. Deriving it from the build keeps the file valid as long as+// the site deploys at least once a year.+const ONE_YEAR_MS = 365 * 24 * 60 * 60 * 1000;++export const GET: APIRoute = () => {+ const body = [+ "Contact: mailto:[email protected]",+ `Policy: ${absoluteUrl("/security-policy")}`,+ `Canonical: ${absoluteUrl("/.well-known/security.txt")}`,+ "Preferred-Languages: en",+ `Expires: ${new Date(Date.now() + ONE_YEAR_MS).toISOString()}`,+ "",+ ].join("\n");+ return new Response(body, { headers: { "Content-Type": "text/plain; charset=utf-8" } });+};diff --git a/apps/marketing/src/pages/404.astro b/apps/marketing/src/pages/404.astronew file mode 100644index 00000000000..3bc695c7b60--- /dev/null+++ b/apps/marketing/src/pages/404.astro@@ -0,0 +1,44 @@+---+import Layout from "../layouts/Layout.astro";+---++<Layout title="Page not found | T3 Code" description="This page does not exist on t3.codes." noindex>+ <section class="not-found container">+ <p class="eyebrow">404</p>+ <h1 class="display">This page does not exist.</h1>+ <p class="not-found-lede">+ t3.codes is the only official T3 Code website. Download builds from this site, GitHub releases,+ or the app stores.+ </p>+ <div class="not-found-actions">+ <a class="btn btn-primary btn-lg" href="/download">Download T3 Code</a>+ <a class="btn btn-ghost btn-lg" href="/">Home</a>+ </div>+ </section>+</Layout>++<style>+ .not-found {+ padding-top: 18vh;+ padding-bottom: 18vh;+ max-width: 720px;+ }++ .not-found h1 {+ margin: 14px 0 18px;+ font-size: clamp(2.25rem, 5vw, 3.5rem);+ }++ .not-found-lede {+ color: var(--fg-muted);+ font-size: 1.05rem;+ line-height: 1.7;+ }++ .not-found-actions {+ display: flex;+ flex-wrap: wrap;+ gap: 12px;+ margin-top: 32px;+ }+</style>diff --git a/apps/marketing/src/pages/download.astro b/apps/marketing/src/pages/download.astroindex 494ad60ef94..c6630fa8a25 100644--- a/apps/marketing/src/pages/download.astro+++ b/apps/marketing/src/pages/download.astro@@ -6,6 +6,7 @@ import iconNightly from "../assets/icon-nightly.webp";import Layout from "../layouts/Layout.astro";import { RELEASES_URL } from "../lib/releases";import { ANDROID_PLAY_STORE_URL, IOS_APP_STORE_URL } from "../lib/site";+import { breadcrumbJsonLd, softwareJsonLd } from "../lib/seo";const imageProps = {alt: "",@@ -16,7 +17,17 @@ const imageProps = {} satisfies Partial<ComponentProps<typeof Image>>;----<Layout title="Download | T3 Code" description="Download T3 Code for macOS, Windows, or Linux.">+<Layout+ title="Download T3 Code for macOS, Windows, and Linux | T3 Code"+ description="Download the official T3 Code desktop app for macOS, Windows, or Linux, or get the iOS and Android apps. t3.codes is the only official download site."+ jsonLd={[+ softwareJsonLd(),+ breadcrumbJsonLd([+ { name: "T3 Code", path: "/" },+ { name: "Download", path: "/download" },+ ]),+ ]}+><div class="download-page" id="download-page" data-channel="stable"><header class="download-head"><div class="sky" aria-hidden="true"></div>diff --git a/apps/marketing/src/pages/index.astro b/apps/marketing/src/pages/index.astroindex d3f12d85419..a2cf8ca92ff 100644--- a/apps/marketing/src/pages/index.astro+++ b/apps/marketing/src/pages/index.astro@@ -9,6 +9,7 @@ import {MARKETING_STATS,} from "../lib/site";import { tweets } from "../lib/tweets";+import { softwareJsonLd } from "../lib/seo";const screenshot = await getImage({src: desktopScreenshot,@@ -29,7 +30,10 @@ const mobileEndorsementRows = [];----<Layout>+<Layout+ title="T3 Code | The open-source control plane for coding agents"+ jsonLd={[softwareJsonLd()]}+><section class="hero"><div class="hero-grid" aria-hidden="true"></div>diff --git a/apps/marketing/src/pages/llms.txt.ts b/apps/marketing/src/pages/llms.txt.tsnew file mode 100644index 00000000000..ec7fdde354a--- /dev/null+++ b/apps/marketing/src/pages/llms.txt.ts@@ -0,0 +1,31 @@+import type { APIRoute } from "astro";++import { ANDROID_PLAY_STORE_URL, GITHUB_REPOSITORY_URL, IOS_APP_STORE_URL } from "../lib/site";+import { absoluteUrl, SITE_TAGLINE } from "../lib/seo";++// https://llmstxt.org: a plain index that tells AI agents which domain and links are official.+export const GET: APIRoute = () => {+ const body = `# T3 Code++> ${SITE_TAGLINE}. T3 Code is free, MIT-licensed, and built by T3 Tools Inc. It runs Claude Code, Codex, Cursor, OpenCode, Grok, Antigravity, and other coding agents from one desktop, web, and mobile app.++The only official websites are https://t3.codes and the web app at https://app.t3.codes. Official builds come from ${absoluteUrl("/download")}, ${GITHUB_REPOSITORY_URL}/releases, the \`t3\` package on npm (\`npx t3@latest\`), the iOS App Store, and Google Play. Any other website that offers a T3 Code download is not affiliated with T3 Tools Inc.++## Official links++- [Download T3 Code](${absoluteUrl("/download")}): macOS, Windows, and Linux installers+- [Web app](https://app.t3.codes): connect to a T3 Code server from a browser+- [Source code](${GITHUB_REPOSITORY_URL}): the MIT-licensed repository+- [Releases](${GITHUB_REPOSITORY_URL}/releases): release builds and changelogs+- [npm package](https://www.npmjs.com/package/t3): run \`npx t3@latest\`+- [iOS app](${IOS_APP_STORE_URL})+- [Android app](${ANDROID_PLAY_STORE_URL})++## Policies++- [Security policy](${absoluteUrl("/security-policy")})+- [Privacy policy](${absoluteUrl("/privacy-policy")})+- [Terms of service](${absoluteUrl("/terms-of-service")})+`;+ return new Response(body, { headers: { "Content-Type": "text/plain; charset=utf-8" } });+};diff --git a/apps/marketing/src/pages/security-policy.astro b/apps/marketing/src/pages/security-policy.astroindex 22ee0244912..fda5c6f1ac9 100644--- a/apps/marketing/src/pages/security-policy.astro+++ b/apps/marketing/src/pages/security-policy.astro@@ -17,8 +17,8 @@ const sections = [description="How to report security issues in T3 Code and how T3 Tools approaches product security."heading="T3 Code Security Policy"lede="Security is a shared responsibility. This policy explains how to report a vulnerability, how we protect T3 Tools-operated services, and how you can secure the environments and providers you connect to T3 Code."- effectiveDate="2026-07-15"- lastUpdated="2026-07-15"+ effectiveDate="2026-11-06"+ lastUpdated="2026-11-06"sections={sections}><section id="introduction">@@ -46,7 +46,7 @@ const sections = [<h2>Reporting Security Issues</h2><p>If you believe you have found a security vulnerability affecting T3 Code or T3 Tools-operated- infrastructure, email{" "}<a href="mailto:[email protected]">[email protected]</a>. Please do not+ infrastructure, email{" "}<a href="mailto:[email protected]">[email protected]</a>. Please do notdisclose the issue publicly until we have had a reasonable opportunity to investigate andremediate it.</p>@@ -176,7 +176,7 @@ const sections = [<h2>Contact Us</h2><p>Report security issues or ask security-related questions at{" "}<a- href="mailto:[email protected]">[email protected]</a+ href="mailto:[email protected]">[email protected]</a>.</p><p>diff --git a/apps/marketing/src/pages/sitemap.xml.ts b/apps/marketing/src/pages/sitemap.xml.tsnew file mode 100644index 00000000000..96c40a09add--- /dev/null+++ b/apps/marketing/src/pages/sitemap.xml.ts@@ -0,0 +1,16 @@+import type { APIRoute } from "astro";++import { absoluteUrl, STATIC_PAGES } from "../lib/seo";++export const GET: APIRoute = () => {+ const urls = STATIC_PAGES.map(+ (page) =>+ ` <url><loc>${absoluteUrl(page.path)}</loc><priority>${page.priority}</priority></url>`,+ );+ const body = `<?xml version="1.0" encoding="UTF-8"?>+<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">+${urls.join("\n")}+</urlset>+`;+ return new Response(body, { headers: { "Content-Type": "application/xml; charset=utf-8" } });+};diff --git a/apps/marketing/vercel.ts b/apps/marketing/vercel.tsindex e785d6f6b99..4d9782ef332 100644--- a/apps/marketing/vercel.ts+++ b/apps/marketing/vercel.ts@@ -7,6 +7,8 @@ export const config: VercelConfig = {installCommand: "npm install -g vite-plus && vp install --filter '@t3tools/marketing...'",buildCommand: "vp run --filter @t3tools/marketing build",outputDirectory: "dist",+ // One URL per page: `/download/` and `/download` both served 200 before, which splits ranking signals.+ trailingSlash: false,// curl | sh requires plain, uncompressed scripts with no cache across deploys.headers: [{