Slot example

On this page we walk you through creating a slot schema using the schema editor, registering it as a slot type and using it to create a slot.

The slot used in this example is a banner slot and it accepts content of the type created from the banner schema. To use this example yourself, ensure that the URL of the banner schema is included in the enum in the slot schema.

Expand the section below to see the complete banner slot schema used in this example.

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "http://example.com/bannerslot.json",

    "title": "Title",
    "description": "Description",

    "allOf": [
        {
            "$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/content"
        }
    ],

    "type": "object",
    "properties": {
        "slotContent":{
            "title": "content",
            "description": "description",
            "type": "array",
            "minItems": 0,
            "maxItems": 5,
            "items": {
                "allOf": [
                    { "$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/content-link" },
                    {
                        "properties": {
                            "contentType": {
                                "enum": [
                                    "http://example.com/tutorialbanner.json"
                                ]
                            }
                        }
                    }
                ]
            }
        }

    },
    "propertyOrder": []
}

Creating a slot type schema

To create a new slot schema, choose "Content type schemas" from the "Development" menu and click the "Create schema" button. Enter a valid URL for the slot schema and choose "Slot" as the validation type. In contrast with content types, certain properties such as image and video choosers cannot be included in a slot type, so the schema editor validation will ensure that the schema is valid.

Click "Save and open schema" to open the schema editor.

Creating a slot schema. Choose Slot as the validation
Creating a slot schema. Choose Slot as the validation

Adding properties

This slot just contains a single property, an array of content that can be added to it. To add the property, choose "List of content links" from the "Add property" menu as shown below.

TAdding the slotContent property
TAdding the slotContent property

Ensure that the URL for the banner schema is included in the enum so that content of this type can be added to the slot.

Adding the banner URL so the slot accepts content of this type
Adding the banner URL so the slot accepts content of this type

If you try and add image or video properties to a slot, the schema validation will fail, as shown in the image below.

Adding an image or video property to a slot schema will cause validation to fail
Adding an image or video property to a slot schema will cause validation to fail

Once you've finished entering the slot properties, click "Save".

Saving the slot schema
Saving the slot schema

Registering a slot type

In order to create a slot from a slot schema, you must first register a slot type by choosing "Content types" from the "Development" menu and choosing "Register content type". The slot type is registered in the same way as a a content type and consists of the slot schema URL, a label and optional settings such as an icon, card and visualization.

To register a slot type from the banner slot schema, select "internal" and choose the banner slot schema from the list of available schemas. Give the slot type a label, in this case "Banner slot". Then choose which slot repositories this slot type should be associated with, in this example we're enabling it on the repository named "Slots". Click "Save" to register the slot type with the hub.

Registering the slot type
Registering the slot type

Creating a slot

The slot type can now be used to create a slot. In the production view choose the slots repository and click "Create slot".

Creating a slot
Creating a slot

Add some dummy data to the slot to allow you to save it.

Saving the slot
Saving the slot

The slot is now available to add to an edition. Planners will then add content to the slot.

Adding the slot to an edition
Adding the slot to an edition

results matching ""

    No results matching ""