Configuring preview for content items

To preview your content before it's published, your developers first need to set up a preview environment. Then you can configure preview URLs in your Kentico Cloud project for each content type and see how the content items based on those types look in your app.

See how to configure previews inside the app.

Table of contents

    In the following example, you will learn how to configure a URL preview for content items based on a content type called Article. You can use the same approach for your own content types.

    Setting up preview URLs

    Your developer needs to configure two things in the project. Add the possibility of specifying URL patterns in content items via the URL slug element, and specify the website address at which the content items are available.

    Adding URL slug element

    Start by adding the element:

    1. From the app menu, choose Content models .
    2. Open the Article content type for editing.
    3. Add the URL slug supporting element to the content type. For example, you can label it Page URL.

    Adding preview URLs for content types

    To set up preview URLs for your project:

    1. In Kentico Cloud, choose Project settings from the app menu.
    2. Under Development, choose Preview URLs.
    3. Type in the URLs to your app in the preview environment.

    The URLs must be absolute, containing protocol, domain, and path, in the following form protocol://domain/path.

    A static preview URL for a homepage of an app running at https://preview.myapp.com can be, for example, https://preview.myapp.com/.

    With more dynamic pages, such as articles translated to multiple languages, we recommend using macros when constructing the preview URLs. There are 2 macros available:

    • {URLslug} – resolves to the value of a URL slug element in a content item.
    • {Lang} – resolves to the codename of the currently selected language in your Kentico Cloud project.

    When you combine the macros, you can create a preview URL such as https://preview.myapp.com/{Lang}/articles/{URLslug} that can resolve to, for example, https://preview.myapp.com/es-es/articles/en-asados.

    Note: Kentico Cloud doesn't check if the URL slug values in your content items are unique across your project. This means you can have multiple content items with the same URL slug.

    What's next?

    In this article, you added the URL slug element to your Article type and then set up the preview URLs for your content types. Your developers should have already set up the preview environment allowing you to preview your unpublished content.