---
title: "Record URLs"
description: "Give a data model a URL pattern so cmssy, the admin and AI assistants produce each record's real storefront link instead of guessing one."
url: https://www.cmssy.com/docs/content/record-urls
---

# Record URLs

Tell cmssy where a model's records live on your storefront, and every record gets its real public link - in the admin, over the API and for AI assistants.

cmssy does not render your site, so it cannot know your routes. A model's **URL pattern** tells it: once set, each published record has a `publicUrl` - your site's public site URL plus the pattern filled from that record. The record editor shows a **View on site** button, and Spotlight and the MCP tools return the link as `url` instead of guessing one from a slug.

## Set a pattern

Open the model, **Basic** tab, and fill **URL on the site**, or pass `urlPattern` to `create_model` / `update_model`. The pattern starts with `/` and is appended to the public site URL from site settings. Leave it empty when records have no page.

- `{fieldKey}` - a visible text, number, date, select or radio field of this model, e.g. `/p/{slug}`.
- `{relationField.fieldKey}` - a field of the record a single relation links to, one hop, e.g. `/shop/{category.slug}/{slug}`.
- `{locale}` - the language the link is asked for, e.g. `/{locale}/p/{slug}`.

Every token is checked when you save: an unknown field, a hidden or password field, a many-relation or bad syntax is refused with the reason. Each value becomes one URL-encoded path segment, so a slug with `/` or spaces stays one segment.

## When there is no link

`publicUrl` is null - and the button hidden - when:

- the model has no URL pattern, or the site has no public site URL;
- the model is not delivered: its delivery access is *none* (the default) or it is the login model - set it to *public* or *members*;
- the record, or a record the pattern reads through a relation, is unpublished;
- a token is empty for that record.

## Languages

Ask for a language with `publicUrl(locale: "pl")`; without one, or for a language the site does not enable, the default language is used. A translatable field is read in that language and falls back to the default language - exactly the way the delivery API's filter matches it, so the storefront's own query finds the record behind every link cmssy gives out.

## Over the API

```
query {
  record {
    get(id: "...") { publicUrl(locale: "en") }
  }
}
```

The field is on admin records and on the product catalog; list queries resolve the whole page in one batch. It is not part of the public delivery API - your storefront already knows its own routes.

## Next steps

- [Data models](https://www.cmssy.com/docs/content/data-models.md) - fields, relations and delivery access.
