|
| 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://x.com/t3dotgg", |
| 14 | + "https://www.youtube.com/@t3dotgg", |
| 15 | + "https://discord.gg/jn4EGJjrvv", |
| 16 | +] as const; |
| 17 | + |
| 18 | +export type JsonLd = Record<string, unknown>; |
| 19 | + |
| 20 | +const ORGANIZATION_ID = `${SITE_ORIGIN}/#organization`; |
| 21 | +const WEBSITE_ID = `${SITE_ORIGIN}/#website`; |
| 22 | +const SOFTWARE_ID = `${SITE_ORIGIN}/#software`; |
| 23 | + |
| 24 | +export const absoluteUrl = (pathname: string): string => new URL(pathname, SITE_ORIGIN).href; |
| 25 | + |
| 26 | +export const organizationJsonLd = (): JsonLd => ({ |
| 27 | + "@type": "Organization", |
| 28 | + "@id": ORGANIZATION_ID, |
| 29 | + name: "T3 Tools Inc", |
| 30 | + url: SITE_ORIGIN, |
| 31 | + logo: absoluteUrl("/apple-touch-icon.png"), |
| 32 | + sameAs: [ |
| 33 | + "https://x.com/t3dotgg", |
| 34 | + "https://www.youtube.com/@t3dotgg", |
| 35 | + "https://github.com/pingdotgg", |
| 36 | + ], |
| 37 | +}); |
| 38 | + |
| 39 | +export const websiteJsonLd = (): JsonLd => ({ |
| 40 | + "@type": "WebSite", |
| 41 | + "@id": WEBSITE_ID, |
| 42 | + name: SITE_NAME, |
| 43 | + url: SITE_ORIGIN, |
| 44 | + publisher: { "@id": ORGANIZATION_ID }, |
| 45 | +}); |
| 46 | + |
| 47 | +export const softwareJsonLd = (): JsonLd => ({ |
| 48 | + "@type": "SoftwareApplication", |
| 49 | + "@id": SOFTWARE_ID, |
| 50 | + name: SITE_NAME, |
| 51 | + description: `${SITE_NAME}. ${SITE_TAGLINE}.`, |
| 52 | + url: SITE_ORIGIN, |
| 53 | + downloadUrl: absoluteUrl("/download"), |
| 54 | + applicationCategory: "DeveloperApplication", |
| 55 | + operatingSystem: "macOS, Windows, Linux, iOS, Android", |
| 56 | + license: "https://opensource.org/license/mit", |
| 57 | + isAccessibleForFree: true, |
| 58 | + offers: { "@type": "Offer", price: "0", priceCurrency: "USD" }, |
| 59 | + codeRepository: GITHUB_REPOSITORY_URL, |
| 60 | + publisher: { "@id": ORGANIZATION_ID }, |
| 61 | + sameAs: [...OFFICIAL_PROFILES], |
| 62 | +}); |
| 63 | + |
| 64 | +export const breadcrumbJsonLd = (items: ReadonlyArray<{ name: string; path: string }>): JsonLd => ({ |
| 65 | + "@type": "BreadcrumbList", |
| 66 | + itemListElement: items.map((item, index) => ({ |
| 67 | + "@type": "ListItem", |
| 68 | + position: index + 1, |
| 69 | + name: item.name, |
| 70 | + item: absoluteUrl(item.path), |
| 71 | + })), |
| 72 | +}); |
| 73 | + |
| 74 | +export const jsonLdGraph = (nodes: ReadonlyArray<JsonLd>): string => |
| 75 | + // `<` is escaped so page text inside the graph can never close the script tag. |
| 76 | + JSON.stringify({ "@context": "https://schema.org", "@graph": nodes }).replace(/</g, "\\u003c"); |
| 77 | + |
| 78 | +// Indexable static pages. The 404 (noindex) and the /95 easter egg stay out of the sitemap. |
| 79 | +export const STATIC_PAGES = [ |
| 80 | + { path: "/", priority: "1.0" }, |
| 81 | + { path: "/download", priority: "0.9" }, |
| 82 | + { path: "/legal", priority: "0.3" }, |
| 83 | + { path: "/privacy-policy", priority: "0.3" }, |
| 84 | + { path: "/security-policy", priority: "0.3" }, |
| 85 | + { path: "/terms-of-service", priority: "0.3" }, |
| 86 | +] as const; |
0 commit comments