# Audit a SvelteKit site's SEO with PageAudit

Write the title and description in svelte:head, serve the sitemap from a route and audit the published page.

PageAudit · Updated 2026-10-16

## Step 1. Write svelte:head

In each +page.svelte, svelte:head carries the page title, description and canonical link.

```svelte
<svelte:head>
  <title>Example home</title>
  <meta name="description" content="What this page offers, in one sentence." />
  <link rel="canonical" href="https://example.com/" />
</svelte:head>
```

## Step 2. Serve the sitemap

Create src/routes/sitemap.xml/+server.js with the site pages. robots.txt goes in the static folder, with a Sitemap line that points to it.

```js
export const prerender = true;
const PAGES = ["/", "/about"];

export function GET() {
  const urls = PAGES.map((p) => `<url><loc>https://example.com${p}</loc></url>`).join("");
  const xml = `<?xml version="1.0" encoding="UTF-8"?>` +
    `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">${urls}</urlset>`;
  return new Response(xml, { headers: { "content-type": "application/xml" } });
}
```

## Step 3. Audit the published page

Change the address to the published page. The answer brings the score, the counts and each error with its fix. No key: 10 free audits a day.

```sh
curl -sS -X POST https://pageaudit.online/api/audit \
  -H 'content-type: application/json' \
  -d '{"url": "https://example.com/"}'
```

[Audit a page](https://pageaudit.online/?url=https://example.com/)

[Audit a SvelteKit site's SEO with PageAudit](https://pageaudit.online/guides/sveltekit)
