# Content Config

Configuration for managing content sources, transforms, and file handling settings.

## Options

Input defaults come from the schema, before transforms and runtime setup. See [configuration reference conventions](/reference/cli/config-loading/#configuration-reference-conventions).

### `sources`

**Input type:** `(object | Promise<object>)[]`

**Required:** No

**Input default:** `[]`

A list of content source options that defines where content is downloaded from. You can configure multiple sources and use different source types simultaneously. Each item accepts `ContentSource | Promise<ContentSource>`: either a source object or a Promise that resolves to one.

For detailed source configuration options, see [Sources Reference](/reference/content/sources/).

```typescript
content({
  sources: [
    defineSource({
      id: 'installation',
      fetch: () => ({ id: 'settings', data: fetchSettings() }),
    }),
  ],
});
```

#### `ContentSource`

Each item has the following fields after its Promise, if any, resolves. Names are relative to one `sources[]` item, not the array itself.

| Field   | Input type               | Required | Input default | Meaning                                                                                           |
| ------- | ------------------------ | -------- | ------------- | ------------------------------------------------------------------------------------------------- |
| `id`    | `string`                 | Yes      | —             | Id of the source. This will be the 'namespace' for the documents fetched from this source.        |
| `fetch` | `ContentSource["fetch"]` | Yes      | —             | Fetches the documents from the source. Returns either an array of documents or a single document. |

### `transforms`

**Input type:** `ContentTransform[]`

**Required:** No

**Input default:** `[]`

A list of content transforms that process content after download. Transforms can modify, analyze, or enhance content before final output.

See [Content Transforms Reference](/reference/content/transforms/) for available transforms and usage.

### `downloadPath`

**Input type:** `string`

**Required:** No

**Input default:** `".downloads/"`

Base directory path where successfully promoted content is published. Fetch runs write into an isolated staged run directory first, then replace the published source directory only after the run succeeds. Can be absolute or relative path.

Relative paths are resolved against the directory of the launchpad configuration.

### `tempPath`

**Input type:** `string`

**Required:** No

**Input default:** `".launchpad/tmp/"`

Temporary directory path used during content processing. Launchpad creates per-run staged workspaces under this directory and removes them after the run completes.

Relative paths are resolved against the directory of the launchpad configuration.

### `backupPath`

**Input type:** `string`

**Required:** No

**Input default:** `".launchpad/backup/"`

Directory path where existing published content can be backed up before processing new downloads. This remains available for compatibility and recovery flows, but normal fetch failure handling now relies on staged output never being promoted.

Relative paths are resolved against the directory of the launchpad configuration.

### `keep`

**Input type:** `string[]`

**Required:** No

**Input default:** `[]`

Glob patterns for files to preserve when clearing directories.

Example:

- `["*.json"]` - Keep all JSON files
- `["**/*.csv", "*.git*"]` - Keep all CSV files in any subdirectory, and any git related files.

### `backupAndRestore`

**Input type:** `boolean`

**Required:** No

**Input default:** `true`

When enabled:

- Creates a backup of existing published files before a fetch run
- Allows Launchpad to restore published content from backup during compatibility recovery flows
- Provides an extra safety net for promotion/recovery problems

Normal fetch failures do not require backup restoration because staged output is discarded until promotion succeeds. Error state is only marked as `restored: true` when at least one source was actually restored from backup.

### `maxTimeout`

**Input type:** `number`

**Required:** No

**Input default:** `30000`

Maximum time in milliseconds to wait for network requests before timing out.

### `encodeChars`

**Input type:** `string`

**Required:** No

**Input default:** `"<>:\"|?*"`

Special characters to encode in file paths for both content and media downloads. Ensures valid filenames across systems.

### `versioning`

**Input type:** `boolean | object`

**Required:** No

**Input default:** `false`

Enables immutable versioned output. Pass `false` to disable versioning, `true` to enable it with the object-field defaults below, or an object to enable it and override individual fields. The parent input default is not a resolved settings object.

```typescript
content({
  versioning: { keepVersions: 5, ackTimeout: '20m' },
});
```

`keepVersions` must be a non-negative integer; active and freshly leased versions remain protected. `ackTimeout` accepts duration shorthand or milliseconds.

| Field          | Input type         | Required | Input default | Meaning                                                                                                              |
| -------------- | ------------------ | -------- | ------------- | -------------------------------------------------------------------------------------------------------------------- |
| `keepVersions` | `number`           | No       | `3`           | Number of versions to retain, in addition to the active version and fresh acks. 0 relies solely on those backstops.  |
| `ackTimeout`   | `string \| number` | No       | `"30m"`       | How long an ack lease stays fresh before the retention sweep ignores it. Accepts duration shorthand or milliseconds. |

See [Versioning](/reference/content/versioning/) for configuration defaults, publishing, retention, mode-switch behavior, and status output. Applications that consume versioned content must follow the [Version Manifest](/reference/content/version-manifest/) contract.
