# Site settings

> Tell Galerne where your site lives so it can preview drafts next to the editor, purge the Tramontane CDN on publish, serve llms.txt and Markdown copies of published documents, and show page views per document.

In the studio, **Settings**, **General** holds what Galerne knows about the site that shows your content. Four features use it: the live preview next to the editor, CDN purges on Tramontane, an agent-readable copy of the site, and content analytics.

## Site URL and routes

| Setting | Example | What it does |
|---|---|---|
| Site URL | `https://www.example.com` | The address of the live site |
| Routes | `post` → `/blog/{slug}`, `page` → `/{lang}/{slug}` | The page URL of each document type |

A route is a path with field names in braces. Besides the fields of the type, `{_id}` and `{lang}` are available. Galerne builds the URL of a document from its route, for purges, for `llms.txt` and for analytics.

## Preview

**Preview URL** is the origin of a site built with the [Next.js kit](/docs/nextjs.md), such as `https://preview.example.com`. When it is set, the document editor has a **preview** button: the site opens next to the fields, in draft mode on the current branch, at mobile, tablet or desktop width. It refreshes after each save, and a click on the page focuses the field.

Saving a preview URL makes a **preview secret**. Set it as `GALERNE_PREVIEW_SECRET` on the site: the studio puts it in the preview link, and the site turns on draft mode only with it. Anyone with the secret sees drafts on the site, so rotate it when someone leaves. Admins see and rotate it on the same page.

## Purge the Tramontane CDN on publish

For sites hosted on Tramontane, fill **Tramontane cache purge** with the purge URL and token of your Tramontane project. When content changes on `main`, Galerne asks Tramontane to purge the page of each changed document and the home page, within a few seconds.

Purges follow `doc.published`, `doc.unpublished`, `doc.deleted`, `branch.promoted` and `release.published` events on `main`, in batches of up to 500 URLs. For other hosts, use a [webhook](/docs/webhooks.md) on the same events.

## llms.txt and Markdown copies

Turn on **Agent-readable site** to publish a plain copy of your published content for AI crawlers and agents:

| URL | What it returns |
|---|---|
| `https://api.galerne.cloud/p/<project>/llms.txt` | An index of published documents, grouped by type, in the [llms.txt](https://llmstxt.org) format |
| `https://api.galerne.cloud/p/<project>/md/<id>.md` | One published document as Markdown: its title, then its fields, rich text as Markdown |

Each entry of `llms.txt` links to the Markdown copy, and to the page on your site when the site URL and a route are set. Drafts and the guidelines document are never included, and the index lists up to 1,000 documents. Both answer `404` while the setting is off. Serve `llms.txt` at your own domain by proxying or redirecting `/llms.txt` to the first URL.

## Site analytics

A managed site counts its visitors on every plan, through Tramontane's web analytics: visitors, page views, bounce rate, top pages, referrers, countries, devices and browsers. The site sends page views with `@tramontane/analytics`, which the site template includes. No cookie is set and the visitor's address never leaves the server: visitors are counted with a hash that changes every day.

Turn it on in **Settings**, **Site**, **Analytics**, or with `set_site_analytics`. Counting starts with the next visit. The card shows the last 30 days and links to all numbers on Tramontane. Agents read them with `site_analytics`:

```bash
curl "https://api.galerne.cloud/p/acme/v1/site/analytics?range=7d" -H "Authorization: Bearer gal_…"
```

Ranges are `24h`, `7d`, `30d` and `90d`. Custom events sent with `track()` from `@tramontane/analytics` appear under `events` on Tramontane's Pro plan.

## Content analytics

On the Business plan, Galerne shows the page views of each published document: views over the last 30 days, per day, and the trend of the last 7 days against the 7 before. It needs the site URL and a route for the type. A managed site reads them from its site analytics, which must be on. Another site hosted on Tramontane reads them from its CDN logs.

Agents read the same numbers with `get_analytics`, or over HTTP:

```bash
curl https://api.galerne.cloud/p/acme/v1/docs/harbours/analytics -H "Authorization: Bearer gal_…"
```

```json
{ "url": "https://www.example.com/blog/harbours", "total": 3120, "last7": 640, "previous7": 820, "trend": -22, "days": [{ "day": "2026-10-16", "views": 91 }] }
```

Sites hosted elsewhere get no analytics.
