Technical SEO implementation with metadata, structured data, and search engine optimization
# SEO Optimization Patterns for Google Antigravity
Implement technical SEO with Google Antigravity's Gemini 3 engine. This guide covers metadata, structured data, sitemaps, and search engine optimization patterns.
## Metadata Configuration
```typescript
// app/layout.tsx
import { Metadata } from 'next';
export const metadata: Metadata = {
metadataBase: new URL('https://example.com'),
title: {
template: '%s | My Site',
default: 'My Site - Your tagline here',
},
description: 'A comprehensive description of your site for search engines.',
keywords: ['keyword1', 'keyword2', 'keyword3'],
authors: [{ name: 'Author Name', url: 'https://author.com' }],
creator: 'Creator Name',
publisher: 'Publisher Name',
openGraph: {
type: 'website',
locale: 'en_US',
url: 'https://example.com',
siteName: 'My Site',
title: 'My Site - Your tagline here',
description: 'Description for social sharing',
images: [
{
url: '/og-image.png',
width: 1200,
height: 630,
alt: 'My Site',
},
],
},
twitter: {
card: 'summary_large_image',
title: 'My Site',
description: 'Description for Twitter',
images: ['/twitter-image.png'],
creator: '@username',
},
robots: {
index: true,
follow: true,
googleBot: {
index: true,
follow: true,
'max-video-preview': -1,
'max-image-preview': 'large',
'max-snippet': -1,
},
},
verification: {
google: 'google-verification-code',
yandex: 'yandex-verification-code',
},
alternates: {
canonical: 'https://example.com',
languages: {
'en-US': 'https://example.com/en-US',
'es-ES': 'https://example.com/es-ES',
},
},
};
```
## Dynamic Metadata
```typescript
// app/products/[slug]/page.tsx
import { Metadata } from 'next';
import { getProduct } from '@/lib/products';
interface Props {
params: { slug: string };
}
export async function generateMetadata({ params }: Props): Promise<Metadata> {
const product = await getProduct(params.slug);
if (!product) {
return {
title: 'Product Not Found',
};
}
return {
title: product.name,
description: product.description,
openGraph: {
title: product.name,
description: product.description,
images: [
{
url: product.image,
width: 800,
height: 600,
alt: product.name,
},
],
type: 'website',
},
twitter: {
card: 'summary_large_image',
title: product.name,
description: product.description,
images: [product.image],
},
alternates: {
canonical: `https://example.com/products/${params.slug}`,
},
};
}
```
## Structured Data Components
```typescript
// components/StructuredData.tsx
interface StructuredDataProps {
data: Record<string, any>;
}
export function StructuredData({ data }: StructuredDataProps) {
return (
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(data) }}
/>
);
}
// Schema generators
export function generateProductSchema(product: Product) {
return {
'@context': 'https://schema.org',
'@type': 'Product',
name: product.name,
description: product.description,
image: product.images,
sku: product.sku,
brand: {
'@type': 'Brand',
name: product.brand,
},
offers: {
'@type': 'Offer',
url: `https://example.com/products/${product.slug}`,
priceCurrency: 'USD',
price: product.price,
availability: product.inStock
? 'https://schema.org/InStock'
: 'https://schema.org/OutOfStock',
seller: {
'@type': 'Organization',
name: 'My Store',
},
},
aggregateRating: product.rating
? {
'@type': 'AggregateRating',
ratingValue: product.rating.average,
reviewCount: product.rating.count,
}
: undefined,
};
}
export function generateArticleSchema(article: Article) {
return {
'@context': 'https://schema.org',
'@type': 'Article',
headline: article.title,
description: article.excerpt,
image: article.image,
datePublished: article.publishedAt,
dateModified: article.updatedAt,
author: {
'@type': 'Person',
name: article.author.name,
url: article.author.url,
},
publisher: {
'@type': 'Organization',
name: 'My Site',
logo: {
'@type': 'ImageObject',
url: 'https://example.com/logo.png',
},
},
mainEntityOfPage: {
'@type': 'WebPage',
'@id': `https://example.com/blog/${article.slug}`,
},
};
}
export function generateBreadcrumbSchema(items: Array<{ name: string; url: string }>) {
return {
'@context': 'https://schema.org',
'@type': 'BreadcrumbList',
itemListElement: items.map((item, index) => ({
'@type': 'ListItem',
position: index + 1,
name: item.name,
item: item.url,
})),
};
}
export function generateFAQSchema(faqs: Array<{ question: string; answer: string }>) {
return {
'@context': 'https://schema.org',
'@type': 'FAQPage',
mainEntity: faqs.map((faq) => ({
'@type': 'Question',
name: faq.question,
acceptedAnswer: {
'@type': 'Answer',
text: faq.answer,
},
})),
};
}
```
## Sitemap Generation
```typescript
// app/sitemap.ts
import { MetadataRoute } from 'next';
import { getAllProducts } from '@/lib/products';
import { getAllPosts } from '@/lib/posts';
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const baseUrl = 'https://example.com';
// Static pages
const staticPages: MetadataRoute.Sitemap = [
{
url: baseUrl,
lastModified: new Date(),
changeFrequency: 'daily',
priority: 1,
},
{
url: `${baseUrl}/about`,
lastModified: new Date(),
changeFrequency: 'monthly',
priority: 0.8,
},
{
url: `${baseUrl}/contact`,
lastModified: new Date(),
changeFrequency: 'yearly',
priority: 0.5,
},
];
// Dynamic product pages
const products = await getAllProducts();
const productPages: MetadataRoute.Sitemap = products.map((product) => ({
url: `${baseUrl}/products/${product.slug}`,
lastModified: new Date(product.updatedAt),
changeFrequency: 'weekly',
priority: 0.7,
}));
// Dynamic blog posts
const posts = await getAllPosts();
const postPages: MetadataRoute.Sitemap = posts.map((post) => ({
url: `${baseUrl}/blog/${post.slug}`,
lastModified: new Date(post.updatedAt),
changeFrequency: 'monthly',
priority: 0.6,
}));
return [...staticPages, ...productPages, ...postPages];
}
// app/robots.ts
import { MetadataRoute } from 'next';
export default function robots(): MetadataRoute.Robots {
return {
rules: [
{
userAgent: '*',
allow: '/',
disallow: ['/api/', '/admin/', '/private/'],
},
{
userAgent: 'Googlebot',
allow: '/',
},
],
sitemap: 'https://example.com/sitemap.xml',
};
}
```
## Best Practices
Google Antigravity's Gemini 3 engine recommends these SEO patterns: Use semantic HTML for content structure. Implement comprehensive metadata for all pages. Add structured data for rich search results. Generate dynamic sitemaps for large sites. Monitor and fix crawl errors regularly.This SEO prompt is ideal for developers working on:
By using this prompt, you can save hours of manual coding and ensure best practices are followed from the start. It's particularly valuable for teams looking to maintain consistency across their seo implementations.
Yes! All prompts on Antigravity AI Directory are free to use for both personal and commercial projects. No attribution required, though it's always appreciated.
This prompt works excellently with Claude, ChatGPT, Cursor, GitHub Copilot, and other modern AI coding assistants. For best results, use models with large context windows.
You can modify the prompt by adding specific requirements, constraints, or preferences. For SEO projects, consider mentioning your framework version, coding style, and any specific libraries you're using.