seo-handler
Manage SEO, sitemaps, and metadata for optimal search engine visibility
What this skill does
# SEO Handler Skill
This skill ensures your Next.js application is optimized for search engines. It covers sitemaps, metadata (OpenGraph), server-side rendering (SSR/ISR), structured data (JSON-LD), and robots.txt configuration.
## Core Principles
1. **Sitemap Visibility**: Every public page MUST be in `src/app/sitemap.ts`.
2. **Metadata Inheritance**: Use `layout.tsx` for defaults; override in `page.tsx`.
3. **Structured Data**: Use `next-seo` components (JSON-LD) on every content page.
4. **Server-Side Data**: Fetch content-heavy data on the server (ISR) for SEO.
5. **Robots Control**: Use `src/app/robots.ts` to guide crawlers.
## 1. Sitemap Management
**File**: `src/app/sitemap.ts`
When adding a new public route (e.g., `/features`), add it to the `staticPages` array.
```typescript
const staticPages = [
"", // Home
"/features", // New page
// ...
];
```
### Splitting Sitemaps (Large Sites)
If you have >50k URLs (e.g., user profiles, products), use `generateSitemaps`.
**File**: `src/app/products/sitemap.ts`
```typescript
import { BASE_URL } from '@/lib/constants';
export async function generateSitemaps() {
// Fetch total count and divide by batch size (e.g., 50,000)
return [{ id: 0 }, { id: 1 }];
}
export default async function sitemap({ id }: { id: { id: number } }) {
const start = id.id * 50000;
const products = await getProducts(start, 50000);
return products.map(product => ({
url: `${BASE_URL}/products/${product.slug}`,
lastModified: product.updatedAt,
}));
}
```
## 2. Metadata & OpenGraph
**Base Layout**: `src/app/layout.tsx` (or group layout) defines the template.
```typescript
export const metadata: Metadata = {
title: {
template: "%s | My App",
default: "My App - The Best SaaS",
},
description: "...",
openGraph: { ... }, // Default OG
};
```
**Page Level**: `src/app/blog/[slug]/page.tsx`
```typescript
export async function generateMetadata({ params }): Promise<Metadata> {
const post = await getPost(params.slug);
return {
title: post.title,
description: post.summary,
openGraph: {
images: [post.coverImage], // Overrides default
},
};
}
```
## 3. Structured Data (JSON-LD)
### Primary: Next-SEO Components
Use `next-seo` components to inject JSON-LD structured data. This helps search engines understand your content (Articles, Products, FAQs, etc.).
**Page Component**: `src/app/blog/[slug]/page.tsx`
```tsx
import { ArticleJsonLd } from "next-seo";
export default function BlogPost({ post }) {
return (
<>
<ArticleJsonLd
useAppDir
url={`https://myapp.com/blog/${post.slug}`}
title={post.title}
images={[post.image]}
datePublished={post.date}
authorName="My App"
description={post.description}
/>
<article>...</article>
</>
);
}
```
### Alternative: Raw JSON-LD (Script Tag)
If a specific schema isn't supported by `next-seo`, use a raw script tag. Wrap in `Suspense` if the data fetching is async.
```tsx
import { Suspense } from "react";
export default function Page() {
const jsonLd = {
'@context': 'https://schema.org',
'@type': 'CustomType',
name: 'Custom Name',
description: 'Description',
};
return (
<section>
<Suspense fallback={null}>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
/>
</Suspense>
{/* Page Content */}
</section>
);
}
```
## 4. Incremental Static Regeneration (ISR)
For content pages (Blogs, Docs, Marketing) that rely on database content, use ISR to cache them at the edge.
**Page Component**:
```typescript
// src/app/blog/[slug]/page.tsx
// 1. Enable ISR
export const revalidate = 3600; // Revalidate every hour (in seconds)
// OR use dynamic params with generateStaticParams for full static export behavior
export const dynamicParams = true;
export async function generateStaticParams() {
const posts = await db.query.posts.findMany();
return posts.map((post) => ({ slug: post.slug }));
}
export default async function BlogPost({ params }) {
// 2. Fetch on Server (Data is cached based on revalidate config)
const post = await getPost(params.slug);
return <article>{/* ... */}</article>;
}
```
## 5. Robots.txt configuration
**File**: `src/app/robots.ts`
Ensure you disallow private routes (`/api/`, `/app/`, `/admin/`) to save crawl budget.
```typescript
export default function robots(): MetadataRoute.Robots {
return {
rules: {
userAgent: "*",
allow: "/",
disallow: ["/api/", "/app/", "/super-admin/"],
},
sitemap: `${process.env.NEXT_PUBLIC_APP_URL}/sitemap.xml`,
};
}
```
Related in Ads & Marketing
ads
IncludedMulti-platform paid advertising audit and optimization skill. Analyzes Google, Meta, YouTube, LinkedIn, TikTok, Microsoft, and Apple Ads. 250+ checks with scoring, parallel agents, industry templates, and AI creative generation.
banana
IncludedAI image generation Creative Director powered by Google Gemini Nano Banana models. Use this skill for ANY request involving image creation, editing, visual asset production, or creative direction. Triggers on: generate an image, create a photo, edit this picture, design a logo, make a banner, visual for my anything, and all /banana commands. Handles text-to-image, image editing, multi-turn creative sessions, batch workflows, and brand presets.
rpg-migration-analyzer
IncludedAnalyzes legacy RPG (Report Program Generator) programs from AS/400 and IBM i systems for migration to modern Java applications. Extracts business logic from RPG III/IV/ILE source code, identifies data structures (D-specs), file operations (F-specs), program dependencies (CALLB/CALLP), and converts RPG constructs to Java equivalents. Generates migration reports, complexity estimates, and Java implementation strategies with POJO classes, JPA entities, and service methods. Use when modernizing AS/400 or IBM i legacy systems, analyzing RPG source files (.rpg, .rpgle, .RPGLE), converting RPG to Java, mapping data specifications to Java classes, planning legacy system migration, or when user mentions RPG analysis, Report Program Generator, RPG III/IV/ILE, AS/400 modernization, IBM i migration, packed decimal conversion, or mainframe application rewrite.
brand-library-architect
IncludedBuild a complete brand library for a product — visual asset render pipeline, brand documentation set (BRAND, COPY, MANIFESTO, BIOS, FAQ, GLOSSARY, TONE, PRICING), open-source convention files (README, CONTRIBUTING, SECURITY, CODE_OF_CONDUCT), and a self-contained press kit. This skill should be used when the user asks to "build a brand library / brand kit / press kit / brand assets" for a product, "set up a brand library workflow," "create a positioning manifesto plus visual identity," or any combination of brand documentation + visual asset pipeline. Apply phase-by-phase or run end-to-end. Templates are product-agnostic and use {{TOKEN}} placeholders the skill prompts the user to fill.
writing-tech-post
IncludedAuthors engineering blog posts end-to-end: launch deep-dives, incident postmortems, architecture migrations, performance case studies, tutorials, AI/agent system writeups, security disclosures, and research-to-product translations. Picks the correct archetype, plans the abstraction ladder, enforces an evidence cadence (diagrams, benchmarks, profiles, traces, code, ablations), tunes voice against publisher house styles (Datadog, Vercel, GitHub, AWS, Meta, Cloudflare, Jane Street), and runs a pre-publish gate for narrative momentum and disclosure ethics. Use when drafting a new engineering post, restructuring a draft that feels flat, deciding which evidence form belongs where, validating that depth and product context are balanced, or preparing a postmortem, migration, or performance narrative for external publication. Do not use for API reference documentation, README authoring, marketing copy, release notes, generic SEO content, ghost-written executive thought leadership, or non-engineering long-form essays.
blog-google
IncludedGoogle API integration for blog performance: PageSpeed Insights, CrUX Core Web Vitals with 25-week history, Search Console performance, URL Inspection, Indexing API, GA4 organic traffic, NLP entity analysis for E-E-A-T, YouTube video search for embedding, and Google Ads Keyword Planner. Progressive feature availability based on credential tier (API key, OAuth/service account, GA4, Ads). Shares config with claude-seo at ~/.config/claude-seo/google-api.json. Use when user says "google data", "page speed", "core web vitals", "search console", "indexation", "GA4", "keyword research", "nlp entities", "blog performance", "youtube search", "google api setup".