# Publish to Payload CMS

> Install the Rivelant plugin on your Payload site and connect it, so Rivelant can create and update posts in one collection.

If your site runs on Payload, Rivelant publishes through a small plugin you add to it. Rivelant can then create posts in one collection and update the posts it manages, and nothing else.

**Requirements:** Payload 3 or 4, one collection for posts, one locale, and a Lexical rich-text body. Publishing images to Payload isn't supported yet.

## 1. Install the plugin

In your Payload project:

```bash
pnpm add @rivelant/payload-plugin
```

Add it to `payload.config.ts`, with your posts collection and where a post lives on your public site:

```ts
rivelantBridge({
  collection: "posts",
  publicUrl: "https://www.example.com/blog/{slug}",
});
```

Then run `payload generate:importmap`, run a migration if your site uses them, and deploy.

## 2. Connect it

1. In Rivelant, open **Settings** › **General** › **Data sources** and click **Connect** on the CMS row (or go to **More pages** › **Articles** › **CMS publishing** › **Add CMS**), and choose **Payload**. In a new project's setup, click **Detect**: when Rivelant finds the plugin, click **Allow Rivelant on …**.
2. Enter your **Payload site URL** and click **Connect**.
3. Your Payload admin opens. Sign in if asked. You'll see **Allow Rivelant to publish on …** with exactly what Rivelant may and may not do. Click **Allow**.
4. You're sent back to Rivelant and see **Payload connected and enabled.**

By default anyone who can use your Payload admin can allow Rivelant; the plugin's `canConnect` option can limit that. In Rivelant, only an organization owner can set up a CMS connection.

### Or paste a connection key

If the redirect doesn't work for you, open `/admin/rivelant` on your Payload site, generate a connection key (it's shown once), and paste it into Rivelant under **Or paste a connection key from the site**. Then click **Save & continue** and **Check & enable**.

## What Rivelant can do

**Rivelant may:** create and publish posts in the chosen collection; edit a post's title, excerpt and body, but only if nobody changed them since Rivelant last read them; take posts down with a redirect, if your setup supports it; find a post from its address.

**Rivelant may not:** change other collections, media, users or settings; delete posts; upload images; sign in or act as you.

## Disconnect

In Rivelant, open **Settings** › **General** › **Data sources** and click **Disconnect** on the CMS row, then confirm. Rivelant stops publishing and deletes the stored key. You can also disconnect from your Payload site: open `/admin/rivelant` and click **Disconnect**. Either way, posts Rivelant published stay as they are.

## If it doesn't work

| You see                                                      | Where    | What to do                                                                                                        |
| ------------------------------------------------------------ | -------- | ----------------------------------------------------------------------------------------------------------------- |
| Your account can't connect Rivelant                          | Payload  | Ask someone who manages the site to allow it, or adjust `canConnect`.                                             |
| This site doesn't connect to the Rivelant at …               | Payload  | Add that address to the plugin's `rivelantOrigins` option. Only `https://app.rivelant.com` is allowed by default. |
| This isn't a connection key from the Rivelant Payload plugin | Rivelant | Copy the key again from `/admin/rivelant`; it must start with `rivelant:payload:`.                                |
| The CMS rejected Rivelant's key                              | Rivelant | Generate a new connection key on your site and add it as a new connection.                                        |
| The CMS could not be reached                                 | Rivelant | Your site must be public and served over HTTPS. Check that the plugin is deployed.                                |
| Payload image publishing needs a media adapter               | Rivelant | Images aren't supported for Payload yet; publish the article without images.                                      |
