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

# Fragments

> A fragment is one card slot on a site: the unit your edge calls. Its id is the fragment_id.

export const Pill = ({variant = "alpha", children}) => <span className={`ds-pill ${variant}`}>{children}</span>;

<Frame>
  <img src="https://mintcdn.com/doubleshift/zL2xEFT9dGekkGCj/images/diagrams/abc-anatomy.svg?fit=max&auto=format&n=zL2xEFT9dGekkGCj&q=85&s=9e90c2522df59c1fefdbc9270e6ca5e2" alt="Two puzzle pieces of the same shape, slightly offset. On the left, the fragment: an empty outline, called from your edge, low latency and cacheable, carrying the page context. On the right, the card: the filled piece that completes it, structured brand data, sourced copy, under 1,000 tokens." width="900" height="340" data-path="images/diagrams/abc-anatomy.svg" />
</Frame>

A **fragment** is one card slot on a site: the unit your edge calls. Think of the page as a puzzle with
one piece missing: the fragment is that gap. You declare it once and it stays empty; for each AI-agent
request your edge asks the fragment endpoint for the piece that fills it, and inlines the card that comes
back.

## Create a fragment

Open a site in the console and create a fragment under it. You set:

| Field             | Meaning                                                                                         |
| ----------------- | ----------------------------------------------------------------------------------------------- |
| **Name**          | A label for the fragment, e.g. "Article footer". Required.                                      |
| **Language**      | One of `fr`, `en`, `de`, `es`, `it`. Passed as `lang` on the endpoint.                          |
| **Description**   | Optional note on where the fragment lives.                                                      |
| **Key-values**    | Targeting params that become `ctx.<key>` on the endpoint. See [Targeting](/targeting).          |
| **Card matching** | Per-fragment `match_mode`: *open*, *brand first*, or *brand only*. See [Targeting](/targeting). |

## The fragment id

Every fragment has an id, shown in the console (e.g. `frg_…`). **That id is your `fragment_id`**, the
value you put in the fragment endpoint URL. One fragment = one `fragment_id`.

## Status: active / paused

A fragment is **active** or **paused**. You can toggle it from the console at any time. While paused,
the fragment endpoint returns a no-fill (<Pill variant="code-204">204</Pill>) for that fragment, so
your pages keep rendering normally with no card, and you never have to touch your edge configuration to pause
delivery.

## Key-values (ctx.\*)

Each fragment can carry **key-values**: your own targeting dimensions. In the console you enter them
one per line as `key: value1, value2` (keys allow `a-z 0-9 _ -`):

```text title="Key-values" theme={"theme":"css-variables"}
section: auto, moto
sponsor: renault
```

Each key becomes a `ctx.<key>` query parameter your edge can append to the fragment URL to narrow which
card serves, for example `&ctx.section=auto`. Full mechanics are on the [Targeting](/targeting) page.

<Tip>
  **One fragment per distinct slot**

  If the same page template has a header slot and a footer slot, or you run different sections with
  different targeting, create one fragment per slot/section. Each gets its own `fragment_id` and its own
  key-values.
</Tip>
