Back to 🚀 Production Readiness

Ultimate Next.js SEO Setup

Next.jsSEOProductionMetadata
---
description: Complete checklist for sitemap, robots, manifest, and JSON-LD
---

1. **Metadata Base (Crucial)**:
- In src/app/layout.tsx, define metadataBase to resolve relative URLs.
export const metadata: Metadata = {
metadataBase: new URL('https://acme.com'),
title: 'Acme Corp',
// ...
};


2. **Dynamic Sitemap (sitemap.ts)**:
- Create src/app/sitemap.ts.
import { MetadataRoute } from 'next';

export default function sitemap(): MetadataRoute.Sitemap {
return [
{
url: 'https://acme.com',
lastModified: new Date(),
changeFrequency: 'yearly',
priority: 1,
},
// Add dynamic routes here
];
}


3. **Robots.txt (robots.ts)**:
- Create src/app/robots.ts.
import { MetadataRoute } from 'next';

export default function robots(): MetadataRoute.Robots {
return {
rules: {
userAgent: '*',
allow: '/',
disallow: '/private/',
},
sitemap: 'https://acme.com/sitemap.xml',
};
}


4. **JSON-LD Structured Data**:
- Add structured data to your layout.tsx.
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify({
'@context': 'https://schema.org',
'@type': 'Organization',
name: 'Acme Corp',
url: 'https://acme.com',
logo: 'https://acme.com/logo.png',
}),
}}
/>


5. **Pro Tips**:
- Use **Open Graph** image generation (opengraph-image.tsx).
- Verify with **Google Search Console**.
By Antigravity Team

How to Use This Workflow

Option A: Project-Specific (Recommended)

  1. Click "Download" above
  2. In your project, create the directory: .agent/workflows/
  3. Save the file as setup-nextjs-seo-sitemap-robots-jsonld.md
  4. In Antigravity, type /setup_nextjs_seo_sitemap_robots_jsonld or just describe what you want to do

Learn more about workflows →

Related Workflows

Recommended Rules

View more rules →

Recommended MCP Servers

View more MCP servers →

Take It Further

Maximize your productivity with these powerful resources

📋

Define Your Standards

Set up coding standards to ensure this workflow produces consistent, high-quality results.

Browse Rules Library
📖

Master Workflows

Learn how to create custom workflows, use Turbo Mode, and build your automation library.

Complete Guide