S.
  • Services
  • For you
  • Solutions
  • Work
  • About
  • Know-how
  • Blog
Start a project
EN/PL/RU
  • Services01
  • For you02
  • Solutions03
  • Work04
  • About05
  • Know-how06
  • Blog07
Start a project
EN/PL/RU
Vlad Sedenko
Independent web product developer
EU / Poland / Warsaw
Products
  • NextWooNext.js storefront for WooCommerce
© 2026. All rights reserved
Services
  • Product Discovery
  • UX/UI Design
  • MVP Development
  • SaaS Development
  • Website Redesign
  • Web Application Security
  • Conversion Optimization
  • API Integrations & Business Automation
  • Product Support
Explore
  • Services
  • For you
  • Work
  • Solutions
  • About
  • Blog
  • Know-how
  • Contact
Start a project
  • vlad@sedenko.net
  • LinkedIn
  • Privacy/Cookies
Know-how/Next.js SEO Checklist: The Complete Guide for App Router (2026)

Part 5 of 22

sitemap.ts and robots.ts: file conventions instead of hand-written XML

sitemap.ts and robots.ts in the Next.js App Router: honest lastModified, splitting large sitemaps, and why robots.txt cannot deindex a page.

2026-07-15
sitemap.ts and robots.ts: file conventions instead of hand-written XML

All topics in this guide

A practical, section-by-section SEO checklist for Next.js: rendering strategy, Metadata API, hreflang, structured data, Core Web Vitals, and optimization for AI answer engines.

The App Router generates both from typed code — no more stale static XML:

// app/sitemap.ts
import type { MetadataRoute } from "next";

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
  const posts = await getPosts();

  const postEntries = posts.map((post) => ({
    url: `https://example.com/en/blog/${post.slug}`,
    lastModified: post.updatedAt,
    alternates: {
      languages: {
        pl: `https://example.com/pl/blog/${post.plSlug}`,
        ru: `https://example.com/ru/blog/${post.ruSlug}`,
      },
    },
  }));

  return [
    { url: "https://example.com", lastModified: new Date(), priority: 1 },
    ...postEntries,
  ];
}
// app/robots.ts
import type { MetadataRoute } from "next";

export default function robots(): MetadataRoute.Robots {
  return {
    rules: [{ userAgent: "*", allow: "/", disallow: ["/api/", "/admin/"] }],
    sitemap: "https://example.com/sitemap.xml",
  };
}

Details that matter:

  • lastModified should be the real content update date, not new Date() on every build — lying about freshness trains Google to ignore the field.
  • Over 50,000 URLs? Use generateSitemaps() to split into multiple files.
  • Don't block CSS/JS in robots.txt — Google needs them to render the page.
  • robots.txt disallow doesn't remove pages from the index — it only stops crawling. To keep a page out of results, use noindex via metadata (robots: { index: false }) and don't block it in robots.txt (blocked pages can't be read, so the noindex is never seen).

Checklist:

  • sitemap.ts includes only canonical, indexable, 200-status URLs
  • lastModified reflects real edits
  • Sitemap submitted in Google Search Console and Bing Webmaster Tools
  • noindex vs robots.txt used correctly (they solve different problems)
← PreviousOpen Graph and dynamic OG imagesNext →Structured data: JSON-LD that earns rich results

01—22

All topics in this guide

  1. 01Rendering strategy: what does the crawler actually see?→
  2. 02Metadata API: titles, descriptions and the template pattern→
  3. 03Canonical URLs and hreflang: one page, one address→
  4. 04Open Graph and dynamic OG images→
  5. 05sitemap.ts and robots.ts: file conventions instead of hand-written XML•
  6. 06Structured data: JSON-LD that earns rich results→
  7. 07Images, fonts and scripts: the classic performance trio→
  8. 08Core Web Vitals: the three numbers Google measures→
  9. 09Redirects, 404s and status codes→
  10. 10Caching and content freshness→
  11. 11AEO/GEO: getting cited by ChatGPT, Perplexity and Google AI Overviews→
  12. 12Monitoring: SEO is a loop, not a launch task→
  13. 13Trust and E-E-A-T: making your site believable→
  14. 14Image SEO: turning pictures into traffic→
  15. 15Internal linking and site architecture→
  16. 16Search intent: pages that match what people actually type→
  17. 17Programmatic SEO in Next.js: pages at scale without the spam→
  18. 18SEO migration: replatforming to Next.js without losing traffic→
  19. 19Pagination and faceted navigation without index bloat→
  20. 20Accessibility and SEO: one job, two rewards→
  21. 21Content decay: refresh, consolidate or prune→
  22. 22Off-page for developers: earning links without buying them→

Want this handled for you?

I audit and fix technical SEO on Next.js sites — indexing, performance, hreflang and AI visibility.

Technical SEO service