Skip to main content
Last updated: 5 Mar 2025

Adding a new content block type

To add a new content block type, follow the instructions below:

Create a new schema in Publishing API

Follow steps 1 to 5 in the instructions in Publishing API for adding a new schema

NOTE: Schemas MUST be prefixed with content_block_* for Content Block Manager to pick them up.

If a content block type has embedded objects, you can use the embedded_object helper, which ensures that all embedded objects have a title and a key to ensure they can be referenced correctly (Example here)

Add expansion rules for your new schema

A good example is in this commit. Failure to do this will mean that updates to content will not get picked up when changes are made

Open a pull request

Once these changes are made, open a pull request to Publishing API and get it approved

Add the schema to Content Block Manager

Update the VALID_SCHEMAS constant in Content Block Manager (and, if necessary, the valid_schemas method).

Add any customisations

There is a config file which allows you to configure (amongst other things):

  • The order of the fields; and
  • What fields are judged to be “embeddable” (this will ensure a Copy Code link appears by that field)

Open another pull request

Once these changes are made, open pull request to Whitehall and get these changes approved

Optional: Add a presenter to Content Block Tools

If there are any custom behaviours required for a content block, you can add a presenter to the Content Block Tools gem.

You can see an example presenter here.