> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Dashboard Page Extension Files and Code

## Article: Dashboard Page Extension Files and Code

## Article Link: https://dev.wix.com/docs/go-headless/wix-managed-headless/full-integration-astro/extensions/dashboard/dashboard-pages/dashboard-page-extension-files-and-code.md

## Article Content:

# Dashboard Page Extension Files and Code

When you generate a dashboard page extension, the CLI adds the following files to your project:

- `<your-page-name>.extension.ts`: Builds the [page](#page-builder).
- `<your-page-name>.tsx`: Defines the [page content](#page-content).

## Page builder

The `<your-page-name>.extension.ts` file contains a dashboard page's builder configuration.

The page builder is defined using the following schema, shown here as a TypeScript type:

```ts
export default extensions.dashboardPage({
  id: string,
  title: string,
  routePath: string,
  component: string,
  priority?: number,
  pageCategoryId?: string,
  fullPage?: boolean,
  metaData?: {
    searchable: boolean,
    description?: string, // Required when searchable is true
    title?: string,
  },
});
```

Here's an example builder definition:

```ts
export default extensions.dashboardPage({
  id: '40c70303-4eac-44cb-bb53-4e583a036682',
  title: 'My Project',
  routePath: 'my-project',
  component: './extensions/dashboard/pages/my-project/my-project.tsx',
  priority: 0,
});
```

### Builder fields

The following fields can be used in the configuration object:

| Field | Type | Description |
|--|--|--|
| `id` | string | Page ID as a ([GUID](https://en.wikipedia.org/wiki/Universally_unique_identifier)). It must be unique across all pages in the project. |
| `title` | string | The page title. The title is used as the browser tab title and as the dashboard sidebar label if the page is configured to appear in the sidebar. |
| `routePath` | string | Route that lead to this page. Use this route in code to reference the page. |
| `component` | string | A route to the page content component. |
| `priority` (optional) | number | Order of this page in the dashboard sidebar when the project has multiple dashboard pages. Smaller numbers appear higher in the list. |
| `pageCategoryId` (optional) | string | ID of the dashboard sidebar category to show this page under. See [Sidebar category (`pageCategoryId`)](#sidebar-category-pagecategoryid). |
| `fullPage` (optional) | boolean | Whether the dashboard sidebar is hidden while the page is open. Default: `false`. |
| `metaData` (optional) | object | How the page appears in dashboard search. See [Dashboard search with metaData](#dashboard-search-with-metadata). |

## Sidebar order (`priority`)

When your project has more than 1 dashboard page, set `priority` on each `extensions.dashboardPage()` so the dashboard sidebar lists the pages in the order you want. Smaller numbers appear higher in the list.

Set `priority` in each page's `<your-page-name>.extension.ts` file. For example, for a project with a Settings page and a Reports page:

```ts
// settings.extension.ts
export default extensions.dashboardPage({
  id: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
  title: 'Settings',
  routePath: '',
  component: './extensions/dashboard/pages/settings/settings.tsx',
  priority: 0,
});
```

```ts
// reports.extension.ts
export default extensions.dashboardPage({
  id: 'b2c3d4e5-f6a7-8901-bcde-f12345678901',
  title: 'Reports',
  routePath: 'reports',
  component: './extensions/dashboard/pages/reports/reports.tsx',
  priority: 10,
});
```

Both pages must be registered in [`src/extensions.ts`](https://dev.wix.com/docs/wix-cli/cli-for-headless/project-structure/folders-and-files/extensions-ts.md). The CLI adds that registration when it generates the extension.

After you change priorities, [build](https://dev.wix.com/docs/wix-cli/cli-for-headless/command-reference/project-commands/build.md) and [release](https://dev.wix.com/docs/wix-cli/cli-for-headless/command-reference/project-commands/release.md) your project so the updated sidebar order is registered. See [Build and Deploy with the CLI](https://dev.wix.com/docs/go-headless/wix-managed-headless/full-integration-astro/development/build-and-deploy-with-the-cli.md).

> **Note:** This `priority` controls the order of dashboard pages in the dashboard sidebar. It isn't the same as the toast `priority` in the [Dashboard SDK](https://dev.wix.com/docs/sdk/host-modules/dashboard/introduction.md), which accepts `low`, `normal`, or `high`.

If you're migrating from the legacy Wix CLI for Headless, copy the page's `compData.backOfficePage.sidebar.priority` value from the page's `extension.json` to the builder's `priority` field.

## Sidebar category (`pageCategoryId`)

To show the page under a [dashboard sidebar category](https://dev.wix.com/docs/overview/extensions-framework/dashboard-extensions/dashboard-sidebar-categories.md), set `pageCategoryId` to the category's ID. Import the ID as `APP_SIDEBAR_CATEGORY_ID` from the category's `.extension.ts` file. In a sidebar category, `priority` orders the page among the category's pages.

If `pageCategoryId` doesn't match a sidebar category, the page appears under **Custom Pages**. For the steps, see [Add Dashboard Sidebar Category Extensions with the Wix CLI](https://dev.wix.com/docs/go-headless/wix-managed-headless/full-integration-astro/extensions/dashboard/dashboard-sidebar-categories/add-dashboard-sidebar-category-extensions-with-the-wix-cli.md).

## Dashboard search with metaData

Use `metaData` to control how the page appears when Wix users search the dashboard. Dashboard search lists the page only when `searchable` is `true` and it has a `description`.

When you generate a dashboard page, the CLI adds `metaData` with `searchable: true` and a default description. Replace the default description with a description of what Wix users can do on the page.

| Field | Type | Description |
|--|--|--|
| `searchable` | boolean | Whether the page appears in dashboard search results. Set to `false` for pages that only work when opened from another page, such as a details or edit page. |
| `description` | string | Description of the page for dashboard search. Required when `searchable` is `true`. Maximum: 200 characters. |
| `title` | string | The page name in dashboard search. Dashboard search doesn't index the page `title`, so set this field to the same value to make the page findable by its name. |

Dashboard search matches the words Wix users type against `metaData.title` and `metaData.description`. Use the words Wix users type when looking for the page.

For example, for a project with a Reports page:

```ts
export default extensions.dashboardPage({
  id: 'b2c3d4e5-f6a7-8901-bcde-f12345678901',
  title: 'Reports',
  routePath: 'reports',
  component: './extensions/dashboard/pages/reports/reports.tsx',
  metaData: {
    searchable: true,
    title: 'Reports',
    description: 'View sales and traffic reports for your site.',
  },
});
```

For a page that only works when opened from another page, set `searchable` to `false`:

```ts
metaData: {
  searchable: false,
},
```

> **Note:** The CLI build doesn't check `metaData` value limits, such as the `description` length. Values outside the limits are rejected when you [release](https://dev.wix.com/docs/wix-cli/cli-for-headless/command-reference/project-commands/release.md) your project.

## Page content

The `<your-page-name>.tsx` file contains a dashboard page's content.

The content is defined as a [React](https://react.dev/) component that renders when the page is active.

Inside a dashboard page component you can use:

- The [Wix Dashboard React SDK](https://dev.wix.com/docs/sdk/host-modules/dashboard/introduction.md) to navigate users to pages in the dashboard, display modals, and send users alerts using toasts.
- The [Wix Design System](https://www.wixdesignsystem.com/) to display content using the same React components Wix uses to build its own dashboard pages.
- The [Wix JavaScript SDK](https://dev.wix.com/docs/sdk.md) to access and manage other Wix data.
- [`httpClient.fetchWithAuth`](https://dev.wix.com/docs/sdk/core-modules/essentials/http-client.md) from `@wix/essentials` to call your project's own [backend HTTP endpoints](https://dev.wix.com/docs/go-headless/wix-managed-headless/full-integration-astro/extensions/backend/http-endpoints/about-http-endpoints.md).