Dynamic Content- Adding a delivery key from a field in the content editing window
Release date: - 14th July 2020Link copied!
In this release we've made it easier to add a delivery key to content items and slots when you're using our next generation Content Delivery API. Users can now add a delivery key in a field in the content editing window, an approach that has several advantages:
- It allows users to add a delivery key directly into content as part of their normal authoring flow.
- Developers can give the delivery key a friendlier name such as url, or blog slug to provide more context for the delivery key field.
- Developers can apply custom validation on the delivery key to ensure that it's valid for your particular use case.
On this page we'll provide a quick overview of the enhanced delivery key functionality. For more detail see the Delivery key page.
Adding a delivery key in the content editing windowLink copied!
Delivery keys are strings of up to 150 characters that can be associated with slots and content items and can be used instead of the content id to retrieve content (you can still retrieve content by id if you choose). A delivery key can be a simple string or a path such as "home-page/main-feature-slot". This makes it simpler for developers to write the integration code and allows users more control over where items of content are delivered.
To allow users to add or edit a delivery key directly in a field in the content editing window, developers need to update their content type schemas to include the
deliveryKey property. When any content items created from a schema that exposes the delivery key are opened for editing, you will be able to add or update the delivery key field. If there is already a delivery key assigned to the item then it will be shown in the delivery key field and you can edit it if you need to.
In the example shown below, we're adding a delivery key of "main-page/promo-banner" to a content item.
When you click "Save", if the delivery key is valid, the content item is saved and the properties pane will be updated to show the URL to retrieve content using this key.
In this example, the content item can be retrieved using the following URL when the content item is published:
If the delivery key is not valid, for example if it starts with "/" then an error will be displayed and the content item cannot be saved until the key is valid.
You can still add a delivery key to a content item or slot from its menu in the Content Library, or from the "Save" menu in the content editing window.