Skip to content

sitemap.xml missing in /public (Pages Router)

Pages Router does not generate a sitemap automatically. Without one, search engines cannot efficiently discover your pages, and newly published content may take weeks to appear in results.

The easiest option is next-sitemap, which generates sitemap.xml automatically after each build.

Terminal window
npm install next-sitemap
next-sitemap.config.js
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: 'https://example.com',
generateRobotsTxt: false,
}

Add a postbuild script so the sitemap regenerates on every deployment.

{
"scripts": {
"postbuild": "next-sitemap"
}
}

For small static sites, a hand-written public/sitemap.xml is fine.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2025-01-01</lastmod>
<priority>1.0</priority>
</url>
</urlset>
Terminal window
curl https://yourdomain.com/sitemap.xml

Confirm the response is valid XML with <urlset> as the root element. Then re-run orino audit.