> ## Documentation Index
> Fetch the complete documentation index at: https://motherfuckingsideproject.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Site Header

> Add a navigation preamble to every markdown response so agents understand your site structure.

# Site Header

> Add a navigation preamble to every markdown response so agents understand your site structure.

Every markdown response AgentXP serves begins with a navigation preamble — a compact markdown block that tells agents your site name and where to find key pages. This gives agents the context they need to navigate your site without having to discover links from page content alone.

## Auto-extraction (default)

By default, AgentXP extracts your site's `<header>` and `<nav>` HTML from each page and converts it into a markdown navigation block. No configuration is required.

The extracted navigation is prepended to every markdown response before the page content. Because it's derived from the live page HTML, it automatically reflects any navigation changes you make to your site.

Manual site headers are recommended for production. They're stable, predictable, and don't break if your nav HTML structure changes.

## Manual site header

Pass a `SiteHeaderConfig` to `withAgentXP()` to replace auto-extraction with a fixed navigation preamble you control.

```typescript theme={null}
import { withAgentXP } from '@reaganhsu/agentxp-next'

export default withAgentXP({
  siteHeader: {
    name: 'My SaaS',
    links: [
      { text: 'Home', href: '/' },
      { text: 'Pricing', href: '/pricing' },
      { text: 'Docs', href: '/docs' },
    ],
    sections: [
      {
        label: 'Documentation',
        links: [
          { text: 'Getting Started', href: '/docs/getting-started' },
          { text: 'API Reference', href: '/docs/api' },
        ],
      },
    ],
    ctaLinks: [
      { text: 'GET STARTED', href: '/signup' },
    ],
  },
})
```

### `SiteHeaderConfig` fields

| Field      | Type                  | Description                                                             |
| ---------- | --------------------- | ----------------------------------------------------------------------- |
| `name`     | `string`              | Site name displayed at the top of the preamble. Required.               |
| `links`    | `SiteHeaderLink[]`    | Standalone links rendered inline (e.g., Pricing, Blog).                 |
| `sections` | `SiteHeaderSection[]` | Grouped navigation sections with a label and list of links.             |
| `ctaLinks` | `SiteHeaderLink[]`    | Call-to-action links rendered after the main nav (e.g., "GET STARTED"). |

### `SiteHeaderLink` fields

| Field  | Type     | Description                                                                        |
| ------ | -------- | ---------------------------------------------------------------------------------- |
| `text` | `string` | Link label.                                                                        |
| `href` | `string` | Absolute URL or root-relative path. Relative paths are resolved against `baseUrl`. |

### `SiteHeaderSection` fields

| Field   | Type               | Description                                |
| ------- | ------------------ | ------------------------------------------ |
| `label` | `string`           | Section heading (e.g., `"Documentation"`). |
| `links` | `SiteHeaderLink[]` | Links listed under this section.           |

## Rendered output

Given the configuration above, AgentXP prepends the following to every markdown response:

```markdown theme={null}
MY SAAS

Documentation:
- [Getting Started](https://yoursite.com/docs/getting-started)
- [API Reference](https://yoursite.com/docs/api)

[Home](https://yoursite.com/) [Pricing](https://yoursite.com/pricing) [Docs](https://yoursite.com/docs)
[GET STARTED](https://yoursite.com/signup)

---

# Page Title

...page content...
```

## Disabling the site header

To disable the site header entirely, omit `siteHeader` from your config or pass `undefined`. Auto-extraction remains active unless you explicitly disable it.

```typescript theme={null}
export default withAgentXP({
  // siteHeader omitted — auto-extraction is used
})
```

If you're using a Route Handler for [markdown overrides](/docs/guides/markdown-overrides), pass the same `SiteHeaderConfig` to `createMarkdownHandler` so both paths produce consistent output.
