# Audit an Astro site's SEO with PageAudit

Put the title, description and canonical link in the layout, generate the sitemap with the official integration and audit the page.

PageAudit · Updated 2026-10-16

## Step 1. Write the layout

In src/layouts/Base.astro, each page passes its title and description. The canonical link uses the site from astro.config.mjs.

```astro
---
const { title, description } = Astro.props;
const canonical = new URL(Astro.url.pathname, Astro.site);
---
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>{title}</title>
    <meta name="description" content={description} />
    <link rel="canonical" href={canonical} />
  </head>
  <body><slot /></body>
</html>
```

## Step 2. Generate the sitemap

Run npx astro add sitemap and check the site in astro.config.mjs. The integration writes /sitemap-index.xml; point to that address in public/robots.txt.

```js
import { defineConfig } from "astro/config";
import sitemap from "@astrojs/sitemap";

export default defineConfig({ site: "https://example.com", integrations: [sitemap()] });
```

## 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 an Astro site's SEO with PageAudit](https://pageaudit.online/guides/astro)
