# Publish contract

What a site you build yourself must hand Site Star so it can be built, published, searched and hosted. Site Star checks the build output, not how you produced it: any generator that writes static HTML works.

## `sitestar.config.json`

One file in the root of the repo. Site Star reads it at the commit being built.

```json
{
  "build": {
    "command": "npm ci && npm run build",
    "output": "dist",
    "node": 22
  },
  "pages": {
    "exclude": ["/drafts/one"]
  },
  "immutable": ["_astro/*"]
}
```

| Key | Required | Meaning |
|---|---|---|
| `build.command` | Yes | Run from the repo root. It installs its own dependencies. |
| `build.output` | Yes | The folder the build writes, relative to the repo root. Forward slashes, no `..`, not absolute. |
| `build.node` | Yes | The Node major version to build with: `22`, `24` or `26`. |
| `pages.exclude` | No | Exact routes to leave out of search and chat, each starting with `/`. Wildcards are refused. |
| `immutable` | No | Path patterns for files whose names carry a content hash. Only these are cached for a long time; every other file is rechecked on each visit. |

A key that is not in this table is an error, and so is a file that is not valid JSON. Every problem is reported at once.

The file holds no business facts. The name, phone, hours and chat settings are kept in Site Star and reach the site through the SDK.

> The build gets no environment variables and no secrets. The SDK needs none, because it talks to the site's own address.

## The output rules

Checked on the output folder after the build command succeeds.

| Rule | If it is broken |
|---|---|
| The output folder exists and holds an `index.html` at its root. | The build fails. |
| Every page is a flat file: `/about` is `about.html`, and `/services/roofing` is `services/roofing.html`. An `index.html` anywhere but the root is refused. | The build fails and lists the files. |
| The home page has at least 100 characters of text in its HTML, not counting navigation, footer, scripts and styles. | The build fails. |
| Nothing sits under `api/v1/` or `data/v1/`, and there is no `.sitestar-release.json`. Site Star serves and writes those itself. | The build fails and lists the files. |
| No `.md` file sits where a page's Markdown copy goes: `about.md` beside `about.html`, or `index.md` at the root. | The build fails and lists the files. |
| Every `.html` file is a whole page with a `<body>`. | The build fails. Remove the file from the output or list its route in `pages.exclude`. |
| The output holds no symbolic links. | The build fails. |
| A page is at most 1 MB of HTML, and a site at most 25,000 pages. | The build fails and says which limit. |
| A `_redirects` file, if there is one, holds only rules Site Star can serve. | The build fails and lists the lines. |

Three things are reported without failing the build:

- **Thin pages.** A page other than the home page with under 100 characters of text is published and listed as having little to find.
- **No `404.html`.** Site Star's default "page not found" page is used.
- **Pages marked `noindex`.** A page with `<meta name="robots" content="noindex">` is published and left out of search and chat.

### Why flat files

Site Star serves `/about` from `about.html`. A page written as `about/index.html` would never be reached, while search and chat would still link to it. Most generators write folders by default and have one setting for flat files. In Astro it is:

```js
// astro.config.mjs
export default defineConfig({
  build: { format: 'file' },
})
```

Confirm it by building and looking in the output folder.

### Why the home page needs text

Search and the chat assistant read each page's HTML without running JavaScript. A site that draws its pages in the browser ships an empty page, so there is nothing to search and nothing for the assistant to answer from. Build the site to static HTML.

## Page details

Site Star reads these from each page's `<head>`. None is required, and each one makes search and chat better.

| Detail | Read from |
|---|---|
| Title | `<title>` |
| Description | `<meta name="description">` |
| Language | `<html lang>` |
| Published and updated dates | `<meta property="article:published_time">` and `article:modified_time` |
| Type | `<meta property="og:type" content="article">` marks an article. Anything else is a page. |

The page's text is taken from `<main>`, or from `<body>` when there is no `<main>`.

## Redirects

A `_redirects` file in the output root, one rule per line: the old path, then the target.

```text
/old-pricing /pricing
/blog/2023-news /news
```

Each rule is an exact path, served as a 301. These are refused:

- a wildcard or placeholder (`*`, `:name`, `:splat`);
- a status other than 301;
- redirecting the home page, or a path ending in `/`;
- a path under `api/v1/` or `data/v1/`;
- a path that is also a real page in the output;
- the same path twice.

## Preview and publish

Both happen in the Site Star dashboard.

### 1. Connect the repo

Connect GitHub, then pick the repo and branch. Site Star checks that it can read the repo and that `sitestar.config.json` is valid before it lets you save.

### 2. Build a preview

Site Star builds the latest commit on the branch, checks the output against the rules above, and publishes it to a preview address. The report lists the pages found, any thin pages, and whether the default "page not found" page was added.

If your build command fails, the dashboard shows the end of its log.

Previewing a commit a second time replaces its earlier build.

### 3. Publish the build

Publishing makes a previewed build the live release. Nothing is rebuilt: the files you previewed are the files that go live. Site Star numbers each release itself; the number has nothing to do with your own versions.

> Publishing is separate from going live. A site that has not gone live yet is published behind its access code. Going live is the paid step that opens it to the public.

## What Site Star does not do

- Change your code, or fix a failing build.
- Run a server for the site, or render it on request.
- Render a browser-drawn site into HTML for you.
- Provide build-time environment variables or secrets.

## Reference

- [Forms](/features/forms)
- [Agent guide for building a site](/agents/site-builder.md)
