yash.apps
Studio · Devlog

I did my Next.js SEO using Claude

19 Nov 2026 · Yash Rawat · 6 min read

This site is a Next.js App Router project, and for weeks its SEO was an afterthought. Paste a link to one of my app pages into WhatsApp and you got the home page's title and no picture. Google had no sitemap to read. So I opened the repo with Claude and asked it to fix the Next.js SEO properly. One afternoon and one commit later, every page describes itself. Here's the set-up, with the code, and what I still checked myself.

1Start with an SEO audit of the codebase

I didn't hand it a generic SEO checklist. I asked it to read the codebase and tell me what was actually wrong. The answer was specific and a little embarrassing: the app, privacy and support pages had no canonical URL and no Open Graph tags of their own, so they all inherited the root layout's. There was no sitemap.xml, no robots.txt, and no structured data.

That's the most common Next.js SEO mistake I've seen: metadata set once in app/layout.tsx and never overridden, so every page shares the home page's title and preview.

2Next.js metadata: canonical URLs and Open Graph on every page

The App Router's Metadata API does the heavy lifting; the trick is calling it on every page. One small helper takes a path, title and description and returns the canonical URL plus Open Graph and Twitter tags for that exact page. App titles now lead with what people search for (“a manual camera for iPhone”), not the way I talk about the apps.

TypeScript
// components/seo/site.ts: one helper for every page's canonical URL and share tags.
export function pageMeta({ path, title, description }: PageMetaInput): Metadata {
  return {
    alternates: { canonical: path },
    openGraph: { title, description, url: path, siteName: 'yash.apps', type: 'website' },
    twitter: { card: 'summary_large_image', title, description },
  }
}

// app/darkmatter/page.tsx
export const metadata = pageMeta({
  path: '/darkmatter',
  title: 'Darkmatter — A manual camera for iPhone',
  description: 'Full control over ISO, shutter speed, white balance and focus…',
})

3Next.js Open Graph images with opengraph-image.tsx

Drop an opengraph-image.tsx file into a route and Next.js generates the image and the og:image tag for you. Mine draw a 1200×630 card from each app's icon, name and accent colour with ImageResponse, so links unfurl properly in WhatsApp, iMessage, Slack and X, and a new app gets its card for free.

TypeScript
// app/darkmatter/opengraph-image.tsx: Next.js turns this into the og:image tag.
import { ogSize, appOgImage } from '@/components/seo/ogImage'

export const size = ogSize // 1200 × 630
export const contentType = 'image/png'
export const alt = 'Darkmatter: a manual camera for iPhone'

export default function Image() {
  return appOgImage('darkmatter') // an ImageResponse drawn from the icon, name and accent colour
}

4A dynamic Next.js sitemap with sitemap.ts

My favourite change. app/sitemap.ts isn't a file I have to remember to update; it's built from the same app and devlog lists that draw the home page. When I published this post, it went into the sitemap automatically, with its date as lastModified.

TypeScript
// app/sitemap.ts → /sitemap.xml, built from the same lists that draw the home page.
export default function sitemap(): MetadataRoute.Sitemap {
  return [
    { url: url('/'), changeFrequency: 'weekly', priority: 1 },
    { url: url('/work'), changeFrequency: 'monthly', priority: 0.9 },
    ...APPS.filter((a) => a.href).map((a) => ({ url: url(a.href!), priority: 0.9 })),
    ...POSTS.filter((p) => p.href).map((p) => ({ url: url(p.href!), lastModified: new Date(p.date) })),
  ]
}

5robots.txt in Next.js with robots.ts

A few lines in app/robots.ts point crawlers at the sitemap and keep API routes and client demos out of the index.

TypeScript
// app/robots.ts → /robots.txt
export default function robots(): MetadataRoute.Robots {
  return {
    rules: { userAgent: '*', allow: '/', disallow: ['/api/', '/demo/'] },
    sitemap: `${SITE_URL}/sitemap.xml`,
  }
}

6JSON-LD structured data in Next.js

Structured data is the part I'd never have done on my own. In the App Router it's just a <script type="application/ld+json"> rendered by a Server Component. The home page now says who I am, each app page is a MobileApplication, posts are articles, and the Work with me page is a professional service with an FAQ. That's what search engines use for rich results and to tie everything back to one person.

TypeScript
// Structured data in a Server Component: no library needed.
const jsonLd = {
  '@context': 'https://schema.org',
  '@type': 'MobileApplication',
  name: app.name,
  operatingSystem: 'iOS',
  applicationCategory: 'MultimediaApplication',
  author: { '@type': 'Person', name: 'Yash Rawat', url: SITE_URL },
}

<script type="application/ld+json" dangerouslySetInnerHTML={jsonLdHtml(jsonLd)} />

7What I still did myself

  • Read every diff. It's my site and my name on it; nothing went in that I didn't understand.
  • Rewrote titles and descriptions that didn't sound like me. Claude drafts well, but I know how my users describe the apps.
  • Checked the share cards by pasting real links into WhatsApp and iMessage, and the structured data in Google's Rich Results Test.
  • Submitted the sitemap in Google Search Console. No tool can do the waiting for you.

My Next.js SEO checklist

  • A unique title and meta description on every page (Metadata API)
  • A canonical URL on every page (alternates.canonical)
  • Open Graph and Twitter tags per page, not inherited from the layout
  • A 1200 × 630 share image per page (opengraph-image.tsx)
  • A sitemap generated from your data (app/sitemap.ts)
  • A robots.txt that points to the sitemap and hides API routes (app/robots.ts)
  • JSON-LD structured data for who you are and what each page is
  • The sitemap submitted in Google Search Console

The short version

AI didn't do magic SEO. It did the careful, boring work I kept putting off, across 36 files, without missing a page, while I made the calls. Rankings take weeks to move, so I'll report back on whether any of it worked.

Need the same for your Next.js site? I do this for clients →