sitemap.xml missing
What this means
Section titled “What this means”A sitemap tells search engines which pages exist, when they were last updated, and how to prioritise them. Without one, crawlers discover pages only by following links. Pages that are poorly linked internally may never be indexed, or may take significantly longer to appear in search results.
This check also flags a sitemap that returns 200 but contains invalid XML (no <urlset> or <sitemapindex> element).
How to fix it
Section titled “How to fix it”Generate a valid sitemap at /sitemap.xml.
Next.js App Router
Section titled “Next.js App Router”Create app/sitemap.ts:
import type { MetadataRoute } from 'next'
export default async function sitemap(): Promise<MetadataRoute.Sitemap> { const posts = await getPublishedPosts()
const staticPages: MetadataRoute.Sitemap = [ { url: 'https://yourdomain.com', lastModified: new Date(), changeFrequency: 'weekly', priority: 1, }, ]
const dynamicPages: MetadataRoute.Sitemap = posts.map(post => ({ url: `https://yourdomain.com/blog/${post.slug}`, lastModified: post.updatedAt, changeFrequency: 'monthly', priority: 0.7, }))
return [...staticPages, ...dynamicPages]}Next.js Pages Router
Section titled “Next.js Pages Router”Use the next-sitemap package:
npm install next-sitemapCreate next-sitemap.config.js at the project root:
/** @type {import('next-sitemap').IConfig} */module.exports = { siteUrl: 'https://yourdomain.com', generateRobotsTxt: true,}Add a postbuild script in package.json:
{ "scripts": { "postbuild": "next-sitemap" }}SvelteKit
Section titled “SvelteKit”Create a server endpoint at src/routes/sitemap.xml/+server.ts:
import type { RequestHandler } from './$types'
export const GET: RequestHandler = async () => { const pages = ['', '/about', '/blog'] const sitemap = `<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">${pages.map(path => ` <url><loc>https://yourdomain.com${path}</loc></url>`).join('\n')}</urlset>`
return new Response(sitemap, { headers: { 'Content-Type': 'application/xml' }, })}Install and configure @nuxtjs/sitemap:
npm install @nuxtjs/sitemapexport default defineNuxtConfig({ modules: ['@nuxtjs/sitemap'], site: { url: 'https://yourdomain.com', },})Install and configure @astrojs/sitemap:
npm install @astrojs/sitemapimport { defineConfig } from 'astro/config'import sitemap from '@astrojs/sitemap'
export default defineConfig({ site: 'https://yourdomain.com', integrations: [sitemap()],})Plain HTML
Section titled “Plain HTML”Create sitemap.xml at the root of your project:
<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>https://yourdomain.com/</loc> <lastmod>2025-01-01</lastmod> <priority>1.0</priority> </url> <url> <loc>https://yourdomain.com/about</loc> <lastmod>2025-01-01</lastmod> <priority>0.8</priority> </url></urlset>Verify the fix
Section titled “Verify the fix”Check that the sitemap is accessible and contains valid XML:
curl https://yourdomain.com/sitemap.xmlThe response should be XML containing at least one <url> entry inside a <urlset> element. Re-run orino audit to confirm the check passes.