Integrations

Payload

Connect your Payload CMS site with an API key and publish articles as live posts.

The Payload integration publishes your Nimblo articles into your Payload CMS. Each article is saved as a live post in your posts collection, and your website shows it the same way it shows posts you write yourself.

Don't see Payload in Settings > Publishing? Ask your workspace admin to connect it.

It works with Payload 2 and 3, for post bodies that use Payload's Lexical editor. The Nimblo block, which shows CTA cards, tables and videos exactly as designed, needs Payload 3. On Payload 2 they are published in a simpler form (see What we publish).

How articles look on your site

Formatting and mobile-friendliness depend on your website's theme and CSS. We deliver semantic content; your theme controls the styling. Learn more

Before you start

  • Your Payload address, for example https://cms.yoursite.com/admin. It must:
    • use https://, since every request sends your API key
    • be reachable from the internet, not localhost or a private network
    • answer without a redirect. Use the exact address you open to log in.
    • keep Payload's admin at /admin and its API at /api on that address. Sites that move them with routes.admin or routes.api can't connect yet.
  • A Payload user for Nimblo with an API key. Its role needs to:
    • read, create and update posts in your posts collection
    • read and create in your media collection, to upload images
    • log in to your Payload admin (Payload 3), so we can find the Nimblo block
  • At least one post in your posts collection. We read your post fields from your existing posts.

How to connect

Go to Settings > Publishing, find Payload under Connect Your Website, and click Connect. The wizard has 4 steps: connect your Payload site, pick your collections, match your fields, and the Payload connected screen.

Create a user with an API key

In your Payload admin, open Users and create a user, for example "Nimblo". Click Generate new API key, copy the key and click Save. In older Payload versions, turn on Enable API Key instead.

Don't see either option? API keys are off on your site. Ask your developer to turn them on (see Your other settings).

Paste your details

In the wizard, paste your Payload address and the API key. Keep Users collection as users unless your site logs in with a different collection. Click Continue. We check the key and its permissions right away.

Pick your collections

Pick the collection that holds your blog posts, usually posts, and the collection that holds your images, usually media. We only list collections the API key's user can create in. If you choose None, publish without images, articles are published without images.

Match your fields

Choose which field of your posts gets each part of the article. We fill in the usual names for you, so most of the time you only confirm them. The article text field must use Payload's Lexical editor. If it uses the older Slate editor, the wizard warns you.

Article partUsual Payload fieldRequired
TitletitleYes
SlugslugYes
Article textcontentYes
Hero imageheroImageNo
Publish datepublishedAtNo
Meta descriptionmeta.descriptionNo

We build each post's link from the Blog path URL in Settings, like yoursite.com/blog/your-article.

Click Connect. You'll see the Payload connected screen with your site, posts and media collections. If your site still needs the Nimblo block, the screen shows your developer how to add it.

Change settings or disconnect

Click the Payload card in Settings > Publishing to open the Payload connected screen. From there you can click Change settings or Disconnect. When you change settings and keep the same Payload address and users collection, leave the API key empty to keep the one you saved. Your field matching stays as you left it.

If you disconnect, articles stop being published to Payload. Posts already in Payload stay.

What we publish

Each article becomes a live post in Payload, not a draft:

  • Title, slug, meta description and date go into the fields you matched.
  • Hero image and images inside the article are uploaded to your media collection, with their alt text.
  • Article text is saved in Payload's Lexical rich text: headings, paragraphs, lists, quotes, links, bold and italic.
  • Links to outside sources are marked nofollow and open in a new tab, once your developer renders them (see Render it on your site). Links to your own pages stay followed.

Tables, videos, CTA cards and the FAQ schema depend on whether your site has the Nimblo block. We check when you open the Payload connected screen or click Check again there, and every time an article publishes. On Payload 2 we can't find the block, so articles are always published as in the Without it column:

Article partWith the Nimblo blockWithout it
CTA cardsExactly as on NimbloA heading, their text and links
TablesExactly as on NimbloA bulleted list, one row per bullet
Lists, if your editor has noneExactly as on NimbloOne line per item, starting with "•"
YouTube videosThe video playerA link to the video
FAQ and article schema (JSON-LD)Included, for rich resultsLeft out
Linked images, like your logoExactly as on NimbloThe image, then its link as text

Here's one of our own articles, published to Payload's website template with the Nimblo block set up:

We only use what your editor supports, so every post opens in your Payload admin. If your editor has no lists, they go in the Nimblo block, or become lines starting with "•" without it. If it has no image upload but has an image block (like Payload's website template), images go in that block. If it has neither, images in the text are left out.

Publishing the same article again updates its post instead of creating a copy. Fields you set yourself in Payload, like the author or categories, are kept. If you deleted the post in Payload, a new one is created.

For your developer

Your website reads posts from Payload, so the article shows up wherever your site already lists blog posts. These steps make it look exactly like it does on Nimblo.

1. Add the Nimblo block

One block holds what Payload's rich text can't: CTA cards, tables, videos and the FAQ schema. We send them as ready-made HTML, styled inline, so they look the same on any site.

Add the block to the editor of your posts' body field. If the editor already has a BlocksFeature, add ArticleHtml to its list of blocks:

import { BlocksFeature, lexicalEditor } from '@payloadcms/richtext-lexical';
import type { Block, CollectionConfig } from 'payload';

export const ArticleHtml: Block = {
  slug: 'articleHtml',
  labels: { singular: 'Nimblo block', plural: 'Nimblo blocks' },
  fields: [{ name: 'html', type: 'code', admin: { language: 'html', readOnly: true } }],
};

export const Posts: CollectionConfig = {
  slug: 'posts',
  fields: [
    {
      name: 'content',
      type: 'richText',
      editor: lexicalEditor({
        features: ({ defaultFeatures }) => [
          ...defaultFeatures,
          BlocksFeature({ blocks: [ArticleHtml] }),
        ],
      }),
    },
    // ...your other fields
  ],
};

Then deploy your Payload site. We find the block on the post edit page of your Payload admin, so it needs to be live there, and the Nimblo user needs to be able to log in to the admin. The block needs Payload 3: Payload 2's admin doesn't show us the editor, so on Payload 2 the Payload connected screen says so instead of showing these steps.

Already connected? Nothing else to do. We check again when you open the Payload connected screen or click Check again there, and every time an article publishes.

The Payload connected screen also shows these steps, with copy buttons, until the block is found:

In your Payload admin, the block shows as read-only HTML between the article's text:

2. Render it on your site

Render the block's HTML as it is, give headings their id so the table of contents links work, and add the nofollow we send on links to outside sources. This example needs Payload 3.2 or newer. On older versions, make your heading renderer copy the heading's id to the tag:

import { cloneElement, isValidElement } from 'react';

import type { SerializedBlockNode, SerializedLinkNode } from '@payloadcms/richtext-lexical';
import { JSXConverter, JSXConvertersFunction, RichText } from '@payloadcms/richtext-lexical/react';

type ArticleHtmlNode = SerializedBlockNode<{ blockType: 'articleHtml'; html: string }>;

// Adds the rel (nofollow) sent on outside links to your link converter.
const withRel =
  (linkConverter?: JSXConverter<SerializedLinkNode>): JSXConverter<SerializedLinkNode> =>
  (args) => {
    const link = typeof linkConverter === 'function' ? linkConverter(args) : linkConverter;
    const { rel } = args.node.fields as { rel?: string };
    return rel && isValidElement<{ rel?: string }>(link) ? cloneElement(link, { rel }) : link;
  };

const converters: JSXConvertersFunction = ({ defaultConverters }) => ({
  ...defaultConverters,
  blocks: {
    articleHtml: ({ node }: { node: ArticleHtmlNode }) => (
      <div dangerouslySetInnerHTML={{ __html: node.fields.html }} />
    ),
  },
  heading: ({ node, nodesToJSX }) => {
    const Tag = node.tag;
    return <Tag id={(node as { id?: string }).id}>{nodesToJSX({ nodes: node.children })}</Tag>;
  },
  link: withRel(defaultConverters.link),
});

<RichText data={post.content} converters={converters} />;

If your site already passes converters to RichText, like Payload's website template does, add articleHtml to its blocks and the heading converter next to the others. If it uses LinkJSXConverter({ internalDocToHref }) for links, wrap that one, so links to your own pages keep working:

link: withRel(LinkJSXConverter({ internalDocToHref }).link),
Not using React? (Astro, Vue, Svelte, plain HTML)

Use Payload's HTML converter (Payload 3.28 or newer) to turn the post body into HTML, then put that HTML in your page:

import type { SerializedBlockNode } from '@payloadcms/richtext-lexical';
import { HTMLConvertersFunction, convertLexicalToHTML } from '@payloadcms/richtext-lexical/html';

type ArticleHtmlNode = SerializedBlockNode<{ blockType: 'articleHtml'; html: string }>;

const converters: HTMLConvertersFunction = ({ defaultConverters }) => ({
  ...defaultConverters,
  blocks: {
    articleHtml: ({ node }: { node: ArticleHtmlNode }) => node.fields.html,
  },
  heading: ({ node, nodesToHTML, providedStyleTag }) => {
    const { id } = node as { id?: string };
    const children = nodesToHTML({ nodes: node.children }).join('');
    return `<${node.tag}${id ? ` id="${id}"` : ''}${providedStyleTag}>${children}</${node.tag}>`;
  },
});

const html = convertLexicalToHTML({ data: post.content, converters });

If your site already has HTML converters, add articleHtml to its blocks and the heading converter next to the others, so blocks you already render, like an image block, keep working.

For nofollow on outside links, add the link's rel (node.fields.rel) to the <a> tag in your link converter.

3. Your other settings

Turn on API keys. Nimblo signs in with an API key, which Payload turns on per auth collection:

export const Users: CollectionConfig = {
  slug: 'users',
  auth: { useAPIKey: true },
  // ...
};

Required fields. If your posts collection requires a field we don't fill, such as an author, Payload refuses the post and the error names that field. Give the field a default value, or make it optional.

Slate editor. Post bodies that use Payload's older Slate editor aren't supported. Switch the field to the Lexical editor to publish to it.

Does your site build pages ahead of time or cache them? A new post shows up once your site rebuilds or its cache refreshes.

Check that it works

New articles publish to Payload automatically when Automatically Publish is on in Settings > Publishing. To check the connection now:

  1. Open any article from Blog content and click Publish in the article sidebar.
  2. Open your Payload admin and go to your posts. The article appears there.

The post's link shows in Nimblo once the page is live on your website. If your site rebuilds after new posts, this can take a few minutes, or until your sitemap updates.

Troubleshooting & FAQ

"Payload didn't accept the API key"

Re-copy the key from the Nimblo user in your Payload admin, and check that Users collection in the wizard is the collection that user belongs to. If the user has neither Generate new API key nor Enable API Key, API keys are off: see Your other settings.

"The API key's user can't create and update posts" or "Payload refused the API key"

The user is missing a permission. Check that its role can read, create and update posts, and read and create in your media collection (see Before you start). Then try again, or use a different user. If the message says the user can't upload images, the media permission is missing.

"serverUrl must be the https address of your Payload site"

Your Payload address starts with http://. We only connect over https://, so your API key is never sent unencrypted. Use the https:// address of your Payload admin.

"Payload server or collection not found"

Check the Payload address: it's the address you open to log in to your Payload admin. Then check that the collection still exists. If your site moves Payload's API away from /api (with routes.api), it can't connect yet.

"We couldn't open your Payload admin"

We look for the Nimblo block on a post's edit page in your Payload admin. Check that the admin opens at your Payload address followed by /admin, without a redirect, and that the Nimblo user can log in to it. Then click Check again.

"Your site runs Payload 2"

The Nimblo block needs Payload 3, so on Payload 2 articles publish without it: CTA cards and tables as simple text, lists and links, videos as links, and no FAQ schema. Everything else publishes as usual. Upgrade to Payload 3, add the block, and new articles use it.

"No post found in the collection"

We read your post fields from your existing posts. Create at least one post in that collection, then try again.

"Payload refused the post"

Your posts collection requires a field we don't fill, and the message names it. Ask your developer to give it a default value or make it optional.

A field is missing from the field list.

We list the fields that are filled on your newest posts. Fill that field on one of your posts, save it, and click Change settings to match it.

The block steps still show after my developer added the block.

Check that the block's slug is articleHtml, that it has a field named html, and that it's in the editor of the body field you matched in the wizard. Then check that the change is deployed: we look for the block on the post edit page of your Payload admin, which needs Payload 3.

Links to outside sources show as followed on my site.

We send those links with nofollow, but Payload only shows it once your site renders it. Ask your developer to add the link converter from Render it on your site. Then republish an article, or wait for your site to rebuild.

"Payload already has a post with the slug"

Your posts collection already has a post with the article's slug, which we never write over. Change the slug of the article in Nimblo or of the post in Payload, then publish again.

Can I publish articles as drafts first?

No. Articles are always saved as published posts in Payload. If you don't want new articles to go live on their own, turn off Automatically Publish in Settings > Publishing and publish each article yourself.

Can I republish an article after editing it?

Yes. Open the article from Blog content. In the article sidebar, click Published (or Re-Publish if you changed the slug), then click Yes to confirm. We update the same Payload post and keep fields you set in Payload, like the author.

Need more help?

Contact Nimblo.