Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Seo Handler

ASecurity

Manage SEO, sitemaps, and metadata for optimal search engine visibility

416 stars
0 votes
0 copies
2 views
Added 2/7/2026
developmenttypescriptreactnextjsapidatabase

Works with

api

Security Analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned 2/10/2026

$npx -y skills add aiskillstore/marketplace --skill seo-handler --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Seo Handler?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Seo Handler
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aiskillstore-seo-handler/badge)](https://www.skillsdirectory.com/skills/aiskillstore-seo-handler)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: seo-handler
description: Manage SEO, sitemaps, and metadata for optimal search engine visibility
tools: Read, Write, Edit
model: inherit
---

# 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`,
  };
}
```

Attribution

aiskillstoreaiskillstore
View sourceSee grades on GitHubMore from aiskillstore →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Clean Code

Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments

304955 votes

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

285172 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2222 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Tanstack Start

Build a full-stack TanStack Start app on Cloudflare Workers from scratch — SSR, file-based routing, server functions, D1+Drizzle, better-auth, Tailwind v4+shadcn/ui. Use whenever the user mentions TanStack Start, asks to scaffold a full-stack Cloudflare app with SSR, wants an SSR dashboard, or asks for a React 19 + Cloudflare Workers app with file-based routing and server functions — even if they don't name TanStack Start specifically. No template repo — Claude generates every file fresh per ...

10341 votes
View all in development →