# mergeSlugRegistry

**Kind:** Function

**Source:** [`atloria-monorepo/apps/api/src/docs-repo/sidecar.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/apps/api/src/docs-repo/sidecar.ts#L226)

Merge the current served set into the existing registry and return the deterministic string.

For each page (keyed by docUuid): upsert slug/scope/lang/kgEntityId. If the slug CHANGED from
the stored one, append the old slug to previousSlugs (dedup, keep order). Entries for docUuids
no longer served are RETAINED — the ledger is an identity history, not a mirror of the live set
(a page can be unpublished then republished under the same identity, and rename history must
survive a doc dropping out of the served set for a version).

## Signature

```ts
function mergeSlugRegistry(existingJson: string | null | undefined, pages: PageIdentity[]): string
```

## Parameters

| Name | Type |
|---|---|
| `existingJson` | `string | null | undefined` |
| `pages` | `PageIdentity[]` |

**Returns:** `string`
