Explorar el Código

Add structured data to the homepage (#8427)

Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>
Matt Rubens hace 3 meses
padre
commit
f8ed7a7931

+ 2 - 0
apps/web-roo-code/src/app/page.tsx

@@ -14,6 +14,7 @@ import {
 } from "@/components/homepage"
 import { EXTERNAL_LINKS } from "@/lib/constants"
 import { ArrowRight } from "lucide-react"
+import { StructuredData } from "@/components/structured-data"
 
 // Invalidate cache when a request comes in, at most once every hour.
 export const revalidate = 3600
@@ -23,6 +24,7 @@ export default async function Home() {
 
 	return (
 		<>
+			<StructuredData />
 			<section className="relative flex h-[calc(125vh-theme(spacing.12))] items-center overflow-hidden md:h-[calc(80svh-theme(spacing.12))]">
 				<AnimatedBackground />
 				<div className="container relative flex items-center h-full z-10 mx-auto px-4 sm:px-6 lg:px-8">

+ 26 - 0
apps/web-roo-code/src/components/structured-data.tsx

@@ -0,0 +1,26 @@
+import { getStructuredData } from "@/lib/structured-data"
+
+/**
+ * StructuredData Component
+ *
+ * Renders JSON-LD structured data in the document head for SEO.
+ *
+ * The structured data includes:
+ * - Organization information (brand, logo, social profiles)
+ * - WebSite metadata (site name for Google Search)
+ * - SoftwareApplication details (VS Code extension)
+ *
+ * @see https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data
+ */
+export function StructuredData() {
+	const structuredData = getStructuredData()
+
+	return (
+		<script
+			type="application/ld+json"
+			dangerouslySetInnerHTML={{
+				__html: JSON.stringify(structuredData),
+			}}
+		/>
+	)
+}

+ 1 - 1
apps/web-roo-code/src/lib/seo.ts

@@ -3,7 +3,7 @@ const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://roocode.com"
 export const SEO = {
 	url: SITE_URL,
 	name: "Roo Code",
-	title: "Roo Code – Your AI-Powered Dev Team in VS Code and Beyond",
+	title: "Roo Code – The AI dev team that gets things done",
 	description:
 		"Roo Code puts an entire AI dev team right in your editor, outpacing closed tools with deep project-wide context, multi-step agentic coding, and unmatched developer-centric flexibility.",
 	locale: "en_US",

+ 127 - 0
apps/web-roo-code/src/lib/structured-data.ts

@@ -0,0 +1,127 @@
+import { SEO } from "./seo"
+import { EXTERNAL_LINKS } from "./constants"
+
+/**
+ * Type definitions for Schema.org structured data
+ */
+interface ImageObject {
+	"@type": "ImageObject"
+	url: string
+	width: number
+	height: number
+}
+
+interface Organization {
+	"@type": "Organization"
+	"@id": string
+	name: string
+	url: string
+	logo: ImageObject
+	alternateName: string[]
+	sameAs: string[]
+}
+
+interface WebSite {
+	"@type": "WebSite"
+	"@id": string
+	url: string
+	name: string
+	alternateName: string[]
+	publisher: { "@id": string }
+}
+
+interface SoftwareApplication {
+	"@type": "SoftwareApplication"
+	"@id": string
+	name: string
+	applicationCategory: string
+	operatingSystem: string
+	url: string
+	downloadUrl: string
+	offers: {
+		"@type": "Offer"
+		price: string
+		priceCurrency: string
+	}
+	isAccessibleForFree: boolean
+	publisher: { "@id": string }
+}
+
+interface StructuredDataGraph {
+	"@context": "https://schema.org"
+	"@graph": [Organization, WebSite, SoftwareApplication]
+}
+
+/**
+ * Generates the complete JSON-LD structured data for SEO
+ *
+ * This includes:
+ * - Organization schema (brand identity, logo, social profiles)
+ * - WebSite schema (site name for Google Search)
+ * - SoftwareApplication schema (VS Code extension metadata)
+ *
+ * @returns Complete structured data object ready for JSON-LD injection
+ */
+export function getStructuredData(): StructuredDataGraph {
+	// Organization ID - used to link all entities
+	const orgId = `${SEO.url}#org`
+
+	const organization: Organization = {
+		"@type": "Organization",
+		"@id": orgId,
+		name: SEO.name,
+		url: SEO.url,
+		logo: {
+			"@type": "ImageObject",
+			url: `${SEO.url}/android-chrome-512x512.png`,
+			width: 512,
+			height: 512,
+		},
+		alternateName: ["RooCode"],
+		sameAs: [
+			EXTERNAL_LINKS.GITHUB,
+			EXTERNAL_LINKS.MARKETPLACE,
+			EXTERNAL_LINKS.X,
+			EXTERNAL_LINKS.LINKEDIN,
+			EXTERNAL_LINKS.REDDIT,
+			EXTERNAL_LINKS.DISCORD,
+			EXTERNAL_LINKS.YOUTUBE,
+		],
+	}
+
+	const website: WebSite = {
+		"@type": "WebSite",
+		"@id": `${SEO.url}#website`,
+		url: SEO.url,
+		name: SEO.name,
+		alternateName: ["RooCode"],
+		publisher: { "@id": orgId },
+	}
+
+	const softwareApplication: SoftwareApplication = {
+		"@type": "SoftwareApplication",
+		"@id": `${SEO.url}#vscode-extension`,
+		name: "Roo Code (VS Code extension)",
+		applicationCategory: "DeveloperApplication",
+		operatingSystem: "Windows, macOS, Linux",
+		url: SEO.url,
+		downloadUrl: EXTERNAL_LINKS.MARKETPLACE,
+		offers: {
+			"@type": "Offer",
+			price: "0",
+			priceCurrency: "USD",
+		},
+		isAccessibleForFree: true,
+		publisher: { "@id": orgId },
+	}
+
+	return {
+		"@context": "https://schema.org",
+		"@graph": [organization, website, softwareApplication],
+	}
+}
+
+/**
+ * Type export for use in components
+ */
+export type { StructuredDataGraph }

+ 1 - 1
src/package.json

@@ -20,7 +20,7 @@
 		"type": "git",
 		"url": "https://github.com/RooCodeInc/Roo-Code"
 	},
-	"homepage": "https://github.com/RooCodeInc/Roo-Code",
+	"homepage": "https://roocode.com",
 	"categories": [
 		"AI",
 		"Chat",